bc_ReverseList (Mel Functions)

This is a simple function to reverse string array in mel.

[mel]
global proc string[] bc_ReverseList(string $bcInputList[])
{
string $bcOutputList[];
for($bcItem in $bcInputList)
{
stringArrayInsertAtIndex(0, $bcOutputList, strip($bcItem));
}
return $bcOutputList;
}
[/mel]

The function can be easily called as shown below

[mel]
string $tempStrArray[] = {“red”, “green”, “blue”};
$tempStrArray = bc_ReverseList($tempStrArray);
print $tempStrArray;
// Result: blue green red //
[/mel]

Published by

Barish Chandran

Have got over 12 years of experience in Animation and VFX industry in Particle Effects, Lighting and Programming areas. I started my animation career as Dynamic FX artist and I have credit in more than 30 movie and CGI Series. Then started developing tools and programs for Animation. Now am working as Pipeline Software Developer Lead at MPC.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.