Programming Assessment 2 – MEL Report

Script Overview –

My script is based around character animation, in particular to solve an annoying repetition issue I encountered in animation class.
When creating a walk cycle, it is vital that the movements are absolutely symmetrical i.e – any transformations made on the left hand side controllers are mirrored across to the right hand side and vise-versa.
To further complicate this process, the mirrored tranformations need to be ‘offset’ in time by the right amount of frames in the timeline. If the walk cycle 12 frames per step, then the corresponding position of the other foot would be 12 frames along in the timeline –
These snapshots explain what I mean –

leftRightMatch

I want the animator to use his/her time creatively, only roughing-in the movement of the controls to get the feel for the walk right. Then they would run the script which will make the sides match – to 3 decimal places.
They can then rest assured that everything is perfect. If they make further artistic tweaks, all they need to do is run the script again!

Top-down development  – Version 1


Here is the first draft list of the development steps before I had started building the script –

1. User input – how many frames is the walk cycle? Stored this number in a float variable.

2. Assign all the left controls to a string array.

3. Assign all the right controls to a string array.

4. User to decide which side is to be the master.

5. Copy the animation curve for each of the controllers attributes on the master side.

6. Paste the animation curves to the slave side, offset by the frame amount determined at step one. Ensure that the curve completely replaces what was there.

The reality of writing this script was that many problems were encountered along the way. So the final step list was vastly different this initial one and hopefully shows my greater understanding.

Top-down development  – Version 2

Here is a summary of the final steps required to produce the final working script-
This may not be the exact order that things were done, but it is a more intellectual way of ordering the tasks and is how it best makes sense to me – it is the way I would think about building my next complex script –

1. Decide what input need to comes from the user and design a ‘front End’ to manage the user input data.
2. Break all of the required commands into groups of function or ‘procs’ that will be executed according to this user input.
3. Proc 1 – ‘update attributes ‘ – assigns the user defined controls to a character set, searches the names of the controls to break them into two lists – right side and left side. Then deletes the character set once it has done its job.
4. Proc 2 – ‘enable master’ – activates the appropriate list according to the user’s selection of left or right side as the master side.
5. Proc 3 – ‘Offset anim’ – this is the heart and soul, the guts of the script. It needs to perform the following actions –
a/ Populate the offset variable – tell the script what time-frame the cycle is, based on the user input information.
b/ Copy all the animation curves from the master side.
c/ Pastes all the curves to the corresponding side.
d/ Slides the curve in time according the the offset value.
e/ If the attribute was selected as requiring ‘inverse value scaling’ – inverse scale the curve across the value axis so that the correct mirroring symmetry occurs.

Reflection of script development-

I won’t pretend that I am going to be the next lead developer at ILM but I think that my aim to be a great generalist will strongly benefit from the MEL skills I have gained from this subject.
Being a master of your tools defines the difference between a highly skilled CG artist and someone who just gets by on artistic ability alone.
It also help your skills in problem solving, encouraging the breaking down of complex problems into a series of smaller, less daunting tasks (2005).

I have achieved several things from this class –

– I have a great animation script that I will actually use
– I have the foundations to go on and explore not only MEL but also Python which will be extra helpful given my ambitions of learning NUKE to a high level.
– probably most important of all, it has removed the fear factor. As David Gould (2003)says in Complete maya programming (2003) – “For many, the mere mention of programming provokes fear and trepidation.”
This was definitely me, I used to avoid any tutorials/experiments that involved any degree of scripting- especially when it comes to rigging.
I now feel that I can go on and explore other peoples scripts, use them for my own workflows and learn from them.

 

Gould, D 2003, Complete Maya Programming, Morgan Kaufmann Publishers, San Francisco, CA

M Wilkins, C Kazmier 2005, MEL scripting for Maya Animators, Morgan Kaufmann Publishers, San Francisco, CA

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s