top of page

A selection of Mel scripts for Maya and links to useful tools I have come across that have proven very handy.

Removing scene name from imported object (like the pasted suffix)

namespace -mv "Insert scene name to be removed here" ":" -force;

Creating a loopable Ncloth sim!

Very handy! can also be used for fluids!

 

http://www.baja.tv/watch/video/uEOkgI19Sh4/maya-ncloth-dynamics-tutorial-looping-flag-sim-using-the-blendcache-node-intermediate-level/

Loopable Image Squence Texture with Offset

Use this is you wish to have a loopable image sequence on a plane and want the animation to start at different times.  i.e - flag animation offset so it looks different on each plane. 

 

Right click the purple box (image number) and edit expression to this -

 

float $movie= 60;  (Length of your sequence)

float $offset = 42;  (Offset you want)

int $firstframe=1;

float $loop=abs(((frame+$offset)%$movie))+$firstframe;

file11.frameExtension=$loop;  (make sure you change file11 to your file name)(and delete all red text!)

REMOVES “pasted__” suffix

If you ever paste something into maya from another Scene it always has a “pasted__” suffix to remove this run this MEL script

 

{

string $pasted[] = `ls "pasted__*"`;

string $object;

for ( $object in $pasted )

{

string $elements[];

// The values returned by ls may be full or partial dag

// paths - when renaming we only want the actual

// object name so strip off the leading dag path.

//

tokenize( $object, "|", $elements );

string $stripped = $elements[ `size $elements` - 1 ];

 

// Remove the 'pasted__' suffix from the name

//

$stripped = `substitute "pasted__" $stripped ""`;

 

// When renaming a transform its shape will automatically be

// be renamed as well. Use catchQuiet here to ignore errors

// when trying to rename the child shape a second time.

// 

catchQuiet(`evalEcho("rename " + $object + " " + $stripped)`);

}

}

Matchmove Shelf

http://minchomarinov.com/MMShelf/index.html

Cones!

This script creates a cone for each selected locator and then puts all created cones into a group called, surprisingly, 'cones'. You'll have to scale up the cones as required.

 

proc trackCone()

{

//Defines Variables

float $pp[];

string $pointCloud[] = `ls -sl -fl`;

 

//Create a cone for each selected locator

for ($eachObject in $pointCloud)

{

$pp = `pointPosition -w $eachObject`;

string $cone[] = `polyCone -r 1 -h 2 -sx 4 -sy 1 -sz 0 -n trackCone_1`;

move -ls 0 1 0 $cone.scalePivot $cone.rotatePivot;

rotate 180 0 0;

move $pp[0] ($pp[1] - 1) $pp[2] $cone;

}

 

//creates a group called 'cones' and adds all cones to it

group -n cones "trackCone_*";

}

trackCone();

Hypershade Texture update (if Hypershade is running slow)

renderThumbnailUpdate 0;

renderThumbnailUpdate 1;

 

 

Outliner off Screen

This script is used when your outliner is no longer displaying. This usually occurs after using maya on second display and then disconnecting the display.

 

Outliner off Screen - (To bring it back)

// check that the outliner window exists

print (`windowPref -exists outlinerPanel1Window` + "\n");

// see where it is

print `windowPref -q -topLeftCorner  outlinerPanel1Window`;

// bring it back to the topleft of the screen

window -e -topLeftCorner 50 50 outlinerPanel1Window;

Please reload

bottom of page