My Mel Script


script overview

I made a script called “Poses Script”. It assigns different poses to a certain rig, the Terry rig. The script creates a window with a coloured button for each pose. Each button has an icon or a picture of the pose on it. When a button is clicked the Terry rig assumes the pose that is assigned to that button.

I decided to make this script because I like animating and I think it would be very useful to have a script that puts a model in certain key poses at the click of a button.

I listed the steps I thought I would need to take to develop my script-

Make a skeleton
Move it into poses required
Note the orientation values of the joints 
Make a window with buttons 
Make the buttons apply the attributes of the joints of the original skeleton poses to the selected skeleton joints.

These are the script goals I thought I would need to achieve in the making of the poses window-

Create procedures or procs for each pose 
Create a window, checking if it exists already and deleting it if it does
Have a button for each pose
Make each button a different colour
Assign an icon of the pose to the buttons as well
Assign a proc to each button starting with reset which tells each joint to assume the values set in the procs

Top Down Development Process

In making my mel script I followed these steps

  • 1st I came up with the idea for a script. After a few thoughts like a body deforming automatically on impact rather than bouncing like hard plastic. I then thought of a window with buttons that put a rig in certain poses would be useful for animating which is the part of 3D that I like to do
  • then I put into words the steps that I should take in order as in the first part above
  • Then I started the scripting part- I experimented with creating windows finally choosing a lay out and buttons I like then I started on the serious business of how to script my idea
  • I made a global proc called resetAll to be able to set the base pose with all controls set to 0.
  • I used the xform command to command the script to set transformation values on chosen joints. The Mel command documentation describes the xform command as “This command can be used to query/set any element in a transformation node.”
  • I put the Terry rig into different poses and noted the rotation and translation values of the controls.
  • I rendered each pose with a ratio of 64 x 64 so it would be small for the icons.
  • I saved each pose render as a PNG  in the computer’s documents file under maya, 2014-x64, prefs, icons. I chose PNG because it has an alpha channel and it would leave the background transparent to allow the colour of my buttons to show.
  • Then I made global procs for every pose listing all the translation and rotation values with the xform command. I put the reseAll at the start of each one. This was to zero everything first so that the poses weren’t just going on top of the others.
  • Then I wrote the part of the script for creating the window and the buttons
  • I made an if statement that finds if the window, myWindow, already exists and if it does to delete it
  • I then created a window titled poses and listed the dimensions and named it myWindow
  • I listed the grid layout with the number of columns and dimensions of each cell
  • then I created the buttons
  • gave them a colour using bgc then 3 numbers for red, green and blue values
  • told it which image to use as an icon
  • told it which proc to use
  • at the end I commanded it to show myWindow.
  • now I have a window with coloured buttons which put Terry into a pose when I click on one


reflection of script development

In this subject I started as a complete newbie knowing absolutely nothing about scripting. I felt overwhelmed because it is a foreign language and every word used has to be the correct one, spelt right and in the right place, not to mention all the new things like ` ++  and arrays, loops, matrices, ‘if’ statements and procs etc etc etc.

I started reading the text books and found that very helpful along with the notes given in the N drive for each week. I have seen Vince write scripts to assign different colours to a group of many grapes and to change a setting on all things in a scene at once and this impressed me as to the usefulness of scriptingt. I saw Emeliano use command documentation to see how to utilise commands and this influenced me to do the same. This came in useful for seeing how to use xform.

We looked at how Maya works and uses mel scripts “Maya’s user interface, which includes all buttons and menus around the edge of the work area, is built using MEL.” (Mark R. Wilkins, 2005) page 20

Then over the weeks we made things like windows with buttons that do things like turn a propeller or make, move and delete poly objects. We made a global proc to list selected objects and rename them. We discovered switch statements, the switch statement is designed for the situation where you have a single variable that can have several specific values for which you want your script to do different things, and recursion which is when you have a procedure that calls itself repeatedly and made a spiral of spheres of decreasing sizes using this. Then we learnt about loops,  a loop is a series of instructions that repeat until set conditions are reached. “Conditional statements let us decide whether to do something; loops let us do things many times.” (Jennifer Campbell, 2009) p131

Then we had to come up with an idea for a script, something we would like to be done in Maya. A first I thought of having a body deform automatically in a collision, but this seemed a bit too much for my level so Emeliano and I came up with this idea for poses in animating.

In making my mel script I followed the steps listed above and am delighted with the resulting window and they way it makes the Terry rig assume the poses.

Based on what I have learnt in this subject and the influences of my teachers and the writers of the text books I can imagine using scripting in future to simplify and automate things that I want Maya to do. I imagine I would use it in a similar way in animating even to use the xform command and list command to find and list the values of the original joints automatically and even assign it to any number of rigs by assigning variables to the subsequent rigs joint names.


Jennifer Campbell, P. G. J.   M. G. W., 2009. Practical Programming – An Introduction to Computer   Science. Raleigh: Pragmatic Bookshelf.

Mark R. Wilkins, C. K., 2005. MEL Scripting for   Maya Animators. 2nd ed. San Francisco: Elsevier.

UFO- after feedback

This was again written over the weeks that I worked on it, trying many different things starting over many times. I am happy with the result and think it fills the brief pretty well.

I love dynamics it is fun and exciting to be able to produce simulations which move dynamically. It is the field of special effects which has been developing ever since movies started. “A century ago, Georges Melies was the first film maker to discover that sheer spectacle was not enough to keep audiences coming back. Hollywood has always sought to provide ever-more spectacular images in order to keep audiences coming back for more. But the advent of digital effects has started to challenge the old rules. In 1993, cinemagoers queued round the block to see the computer-generated wonders of Jurassic Park. Just a few years later such images were almost commonplace.” (Rickitt, n.d.)

Now we are learning the lastest techniques with the hope of building on what we have learnt and trying new ways to produce what a directors’ imaginings could be.  “Particles are versatile and can be rendered in a multitude of ways. Relatively inexpensive to simulate, they can look like sparks or a splash of water. Particles can also be used to drive geometry or be driven by other simulations. Their adaptability makes them a powerful and resourceful tool.” (Palamar, 2010)

Inspiration in images

First, examples that I found inspiring from the client and other images with things he said he liked

moving references that I found: plasma tendrils- movie of sun plasma arms

plasma ball

In these images I am inspired by the moving tendrils and the beams of a varying transparency, the blue colours and the small dots floating in it, also the plasma balls have arms which move about a lot  I would like to have tendrilly arms to go down inside the wider beam and pick up the man. I like a cone of cloudy light and tendrils in the images I think the tractor beam works by first sending down a wide general beam to get the specifications of the position of the target like a radar and when it finds a target it sends down more intense static electricity and plasma ball like tendrils that find the target and draw it up into the UFO.

I looked at plasma balls and the way tendrils move in that, my tendrils were too static and I tried giving them some speed and direction but I can’t get them to move like the arms in a plasma ball so I am trying a cylinder to emit from surface set around the area and goaling them to the tendrils hoping they will move back and forwards more. Not good so I decided to make the tendril trail particles emit then goal to the tendril trails with smoothness to make them oscillate between the 2. No good again.

Made 2 cones of differing width and goaled the new particles to them both but they swung between the top and bottom rather than the sides as I had wanted. Deleted them and made a donut stretched up it fit around the area and goaled that, getting worse. Gave that up and rethought it all from the start. I can’t make the existing tendrils move like an arm it falls apart as dots when I try so maybe I have to have some solid geometry to do the moving and have particles on the surface? But that doesn’t seem to be dynamics enough.

I reread the brief and it is inserted here: “In this shot a UFO (cg element) will swoop into frame from behind the building in the background. The UFO will hover above the grassed area in the quadrangle. It will then open its doors and use its Tractor Beam (cg element) to lift the Mannequin (cg element) up off the ground and into its cargo bay. The doors will then close and the UFO will fly away.” So according to this there does not have to be arms that lift it up and it can be a beam with tendrils shooting around in it. I am going to just make them move and not actually lift the man.

No matter what I cannot make them move after they are emitted! Finally! I gave them a mass, a ramp in the mass attribute, and used a uniform and a turbulence field and I keyed the shape of the newton field which keeps them in, a cone, to expand and contract a few times so it is much more vital now.

I don’t care anymore that the tendrils break up into particles because that was what was restricting me and the feedback asked for  more fine detail in the tendrils and look more like they have a life of their own, to keep moving the entire time and have some wispiness too. I think these details are all present now. Also the colour of the tendrils, it was said, should be more like the reference so I am comparing the 2 and adjusting the ramp in the RGB PP, it is actually lighter than I thought.

The feedback suggested that the small points looked better in the cone so I have gone back to that rather than the cloud and am exploring with points and multipoints. I thought about it and decided I could add more particles emitting from the tendrils like this


– so I have added them and now it looks like this and I think it fits the brief and feedback nicely I decided to add a bit of ‘fluff’ around the edge of the cone on the grass. I made a torus emit particles and made a volume axis field around that in a torus shape too and timed it to the cone. I eventually decided this was too much and not needed. When I referenced the new animation I have to move and lengthen my fx things to match which meant readjusting settings.

Heat Exhaust

I made a cube and sized it and placed it to fit the exhausts then copied that 4 times, 1 for each vent. I adjusted the angles and placement so that the particles emerged at a good place and angle v  selected them all v  emit from surface volume emitter- 1 particle exists for all of them

  • start at a rate of 100 and increase to 300 to get more
  • directional speed 10
  • direction attributes  X=0, Y=1, Z=0
  • away from centre 4, away from axis had no effect unless I changed the shape to a cylinder but then it emitted a hollow tube so I just changed it back and tis worked

v  on the particle shape node

  • live for 6 seconds
  • blobby surface radius 3, threshold .662 so they merge in render view
  • RGB PP- added and given a white to black ramp so they start white and end black
  • Radius PP- added and given a black to white ramp so they start small
    • edit array mapper- min .3, max 3 so they start a bit bigger than 0 and end even bigger
    • Opacity PP- added and given a black to white ramp so they start transparent
      • use the same black to white ramp and edit array mapper- min 1, max 0 so they swap the small and large values, start visible end invisible

On to assigning a shader I remembered that the client said in some feedback that he wanted the tentacles to pick up the man and when I was looking at mine it was very weak with no real connection to the man so… I decided to experiment with emitting from curves as the tendrils to see if I could get more control over them to go down and pick up the man and then go back up.

I drew 3 curves and emitted from them with no speed (speed had them just flying everywhere with no resemblance to the curve).  I changed the particles to spheres to see them clearly and I was amused that the spheres change shape with the curve , now there are points. I put in this creation expression so that they emit all over

tendrilParticleShape3.goalV = parentV; tendrilParticleShape3.goalU = parentU;

I then put in this creation expression to make the particles stay where they are born

tendrilParticleShape3.goalV = tendrilParticleShape3.parentV; tendrilParticleShape3.goalU = tendrilParticleShape3.parentU;

However they stayed in the air where they were when they were born so I group them under the curve and now they stay on the curve. I put a small speed to give some movement and variation of their position Now I want these particles to emit particles which will live for a short time and thus create a wispy trail. But first I thought I had better see if I can goal the man to these tendrils some way  so as not to waste time if it didn’t work.

I made some poly spheres and grouped them to the end of the curves. I was amused that the spheres also change shape with the curve but they will be invisible and it doesn’t matter. I will goal the man’s head and hands to these spheres And I need to animate the curves to move organically too, found that all I could do was rotate it to change it as I had already animated the scale and translate y so I made a skeleton and bound the curve to it so I can animate it.

Had to break connections I had made trying to animate the curve in the first place and made a skeleton for each curve and bound them. That was a mistake it made me spend time with rigging and animating and it moved mechanically. I found I could select the cvs and move them and key them by pressing S so I could animate the curves without a rig just by pushing points around. Then I had a thought what if I somehow made parts of the curve goal to things and make it move organically, So I am trying that.

I was watching a despicable me  mini movie with a ufo and tractor beams in it  and got inspired to dynamically move my tentacle curves. I created 2 poly cylinders and made them long and thin with 3 faces and 60 sudivisions length wise, made them soft bodies, duplicate and the hide the original, and make it a goal of .2 so as not to be too hard.

I made a sphere into a hard body and applied a force to move it through the tentacles, duplicated it a few times and made a newton field to move the balls through the tentacles not successful but when I attached a tentacle to the field it moved- light bulb moment! I deleted the newton field and attached a mild disturbance field to the tentacles and they move organically and dynamically!!!!!

Then I made them start up in the UFO and reach down to the guy then up again- moving all the time unlike my previous attempts where I found the particles wouldn’t stick together if I moved them too much and lost all recognisable shape.

When I tried to make them emit all over with the expressions every time I tried the bloody things slid up and down from the bottom end of the base tentacle shape. So I decided to try to increase the polys and realised I would have to start again so then I thought I would make these particles invisible and emit from them as they move.

I did start again I made the poly tubes wider and they move and change shape dynamically all the time and emit from the particles too so it has a fine trail. I made it irridescent and partly transparent so it looks like tendrils

Now to make the guy be taken up by the tentacles. The class notes say- Pin constraints constrain two Active Rigid Bodies to each other, or, an Active Rigid Body to a Passive Rigid Body. => The pinning point/pivot point is adjustable and it can be key framed. -perfect, seems just what I want!!! I connected the body parts with pins and hinges and chose spheres and cubes as stand ins, gave them mass and other values and it moves like a man’s dead body in response to fields.

I started again on the tendrils in a new scene and made the triangle tubes again with about 40 divisions lengthwise , made a soft body copy goaled to their original, applied springs with stiffness 11 to let it stretch the right length to the mannikin’s hands and painted goal weights on at the top so the top sticks there and off at the bottom so it falls with gravity or uniform field.

I goaled the bottom particles to the hands I made a newton  field emit from these particles to attract the hand and fiddled with the rigid body settings mass, initial velocity, damping  etc and the goaling of the tentacle soft body to its original and it’s stiffness, strength of the newton field etc  til it moved with the tentacle.

I played again with a rig and an ik spline on a soft body curve to try to get the end of the tentacle to stay with the man without much success.

Then it occurred to me that a collision with high friction may work so I made the soft body of the cylinder collide with the hand and split with friction at 1, and it stuck to the hand but did weird things with large solid areas. So I made it not split or emit on collision, the hands rise dynamically in response to the field and the ends of the tentacles sit on them and do not pull up and off like before because because I deleted the animation on the field affecting the tentacles which had it going down then up, now it just goes down all the time and it is the goaling to the original which pulls them up after reaching down. Because they go up slower than the man rises they stay on him.

When I put the tentacles and cubes back in the real scene  and attached the cubes to his hands they rose at a different rate so lots of days were spent trying to make it all work together again.

Lots of time was wasted with the computer freezing with interpenetration of hard bodies.  Finally I made the joint balls not rigid bodies anymore and hid them hoping that would not be too visible and fiddled with fields to make him go up fast enough. I need to get things rendered because the compositing of the renders is due a week earlier so I am trying to get things working well enough to render.

Working on the man again Maya went stupid once more and changed the position of 1 foot and anchor pint for its rigid body in every scene so I had to start again importing a new mannikin and making all the rigid constraints again. I kept the joints in but squashed them a bit and made them close to a part of the geo that I parented them too, skipping these in the constraints. The man goes up dynamically nicely with no collisions.

Oh I also forgot to mention I made each piece have collisions off except the head hoping that the tentacles can stick to that. The cone. The feedback was go back to the smaller points of the cone, at the start there was a cone with another inside If that is what the client  liked, it was in the original brief,  I made that a soft body with springs and attached a turbulence field to move it because the brief was a non static beam.

I added a plane below the man with a surface shader so it blocks the particles that go below ground. I made the plane and particles collide so none would go under ground. But then it showed up in the render so I didn’t use it just fixing that issue in Comp I am really unhappy that I can’t make the tendrils or tentacles move well dynamically while going down and picking up the man.

Then I noticed the way the inner tendrils in the end of the plait of hair of the characters in Avatar move, they are rooted and the ends wave around and also they are attracted to things and entwine around them. I thought maybe they were using paint effects plants so I have been trying out that.

I have made 2 long tubes come from 1 curve and manipulated, the creation, growth, behaviour, forces and flow animation to make it grow down from the UFO in a writhing manner and then curl up into the UFO with the man. I  made it emit from the geo for a short life with expressions in goal U and V and parent U and V to emit all over the surface.

Then I decided it was too boring and wanted to add some small tendrils like in the references so I added another emitter with a slow rate and limited the number to 6 or so and made them emit and those in turn emit again to have small tendrils coming down from the ship in the cone.

I also randomised the shape of the beam by using soft select on the vertices of the original cone geo and moving various levels in and out and making the animation oscillate because the original brief said he didn’t want a plain cone of light.

experimenting with paint effects plants and the results

I composited it all together with the rest, UFO passes, sky, UFO shadow and backgrounds, added some light glow and brought branches to the front in Nuke.


Here is the movie-


Palamar, T., 2010. Maya Studio Projects Dynamics. Indianapolis: Wiley.

Rickitt, R., n.d. Special Effects the history and technique. s.l.:Billboard Books.

UFO- more

I wrote these notes as I did it. I tried many different things and techniques and I hope it is not too hard to follow.

I have the models now so I am trying to reference them and I have changed the tractor beam. There is a man in the bottom of the beam and he gets taken up into the ufo.

This slideshow requires JavaScript.

Here I am playing with rendering with mental ray, some of the particles in this one are spheres


I decided to abandon the thin inner beam and just stick with the wider cone and tendrils.

Below I have put my tractor beam in a file with referenced models etc. I have changed the size of the beam to match the opening in the UFO but I am having trouble making the outer beam particles be transparent since I made Mentalray the renderer. I have made all except 2 streams of particles visible or dynamic.

For the main part of the beam I tried a polypipe into a conish shape with emit from surface, visibility off

I put these expressions on to make particles emit randomly on the UVs

pipeParticlesShape.goalV = pipeParticlesShape.parentV;

pipeParticlesShape.goalU = pipeParticlesShape.parentU;

pipeParticlesShape.goalU = pipeParticlesShape.goalU +0.01;

I had a bit of trouble working out how to use referencing in maya but I think I have it now.

At first I sized my fx all up to the size of the models and so increased the point size on the particles as points and multipoints, increased gravity and the size of the cone geo and the fields.

After I received the scene with geometry and animations etc I scaled it all down to fit my fx and made the particles live longer to reach the guy. Because it looks better in the smaller original scale.

I shrank the particle tube in to fit the guy’s size and particles to goal to him by scaling in the x and z scale of the newton field which constrains the tendrils and they curl down unevenly around just the man now and I like it.

I animated the start and finish of emitting rates to time with the opening of the doors and then animated the cone to start flat and extend to the ground, then reverse at the end.

I tried reversing gravity to make the tendrils go up with the man like it is pulling him up and goaling them to him then a sphere that I animated to ascend before him.


I want the wider beam to be more like a beam of light as in the references but below I have gone back with the maya renderer so that I could get some transparency on the wider beam so I am using a particle sampler node and reverse node to reverse the info of opacity to transparency on the phong as per the notes.


After trying to get tendril particles to follow the man up with little success I made a cylinder with Y scale at .001 and radius 3 and subdivisions axis 6 so that here would be 6 emitting points and animated that to descend and ascend while rotating slowly. I animated the emission rate to be 1000 as it descended and it created an even spiral pattern. I tried a newton field and gravity to bring them up, uniform field worked best turning it on and adjusting the magnitude to match the ascension. I attached the vortex and they flew out so I also attached the newton of the original tendrils. The vortex was too strong so I tried a low turbulence to mess it up a little. I like it. Now the tendrils descend in an ordered spiral then go wiggly and then ascend with the man into the spaceship. I shortened their life to 5 because they were shooting out the top of the ship.

I have tried a new way of making the tendrils and I have playblasted just them not the whole beam below. Now they go down to the man in a nice spiral as per one of the examples in the brief then they go squiggly and pull back up with the man, (so excited that they go up with him now)

Maybe the client will like the more irregular tendrils. Having worked out how to bring the spiral back into the ship I have applied that method- uniform field- to the original tendril particles and shown it below.

Now for the cone particles of the larger beam, I started them again because something broke in Maya and they wouldn’t work at all and I thought I would try something else. This time I made the cone flat and up in the UFO then made gravity pull the particles down then up to drag them back up and placed a drag field under to stop them going way down. Then I tried removing all the fields and making the flat cone go down then up and leave its particles as it went fading over time so as to finally disappear in the upward direction. I then tried attaching a uniform field to drag them up at the end to make it a bit more convincing. I added a drag field at the top to stop particles flying up out the top after they are brought back up.


I am having trouble rendering so I think I must stop fiddling with the particles and spend the last 3 days trying to render. Liar, anyway I made a turbulence field for the cone particles into a cylinder and trapped the particles inside and had it on low.

I made the particles to be software rendered to have translucence so the cone is cloud and the spiral is tubes, decreasing density makes it more transparent and big cloud cell size makes it all like a glowing cloud of the shape I chose coming down from the opening. I am pretty happy with it. I used particle sampler nodes and reverse nodes to get the opacityPP of the prticle working correctly in the transparency of the particle sampler because they are opposites. The roundness of the spiral particles was ramped down to make it more tendrilly. I batch rendered that and it is very regular and a tad boring? It does however have the same spirals as one of the things the client really liked.


This done I wanted to render the tendrils one too. Having trouble with  maya playing up and not rendering in the render view so it was taking too long. I batch rendered some of it with 8 passes and it works so when I get Maya to correctly show particles and changes I am making I will be able to render. Restarting Maya again!

The tendril particles separate as they go up so I decided to try a drag field and trapping the particles as it scales down in the Y scale and translates up into the ufo. Not real good. I changed it to a new gravity field just for the tendrils and fiddled with the strength til it went up the same speed as the man.

I decided to do just a beauty pass at this stage for speed but I made a separate layer each for the ufo, man and beam, if I had more time I may have done the 2 parts of the beam separately so I could just replace 1 part if needed. I am doing the 2 versions of the beam because they are different.

I had a few goes at rendering because of accidentally not confirming the correct camera and incorrectly setting up the render passes for the layers.

I finally rendered, with MentalRay (which worked on batch renders- discovered with small test batch renders- but not when I hit render in render view) – separate beauty passes for the ufo, man, wide beam and tendrils. I realised too late that I had accidentally chosen the wrong format in render settings so I used reformat and transform nodes in Nuke to make up for that when I composited it and finally I rendered it in Nuke and have a real movie of it at last to hand in for the week 9 progress assessment.

This slideshow requires JavaScript.

It  took so long to do just the one scene that I didn’t end up finishing the rendering and comping of the regular spiral one hence I only handed in the irregular tendrils one, that was all that was asked for anyway, just one and I like that one better.