Maya 2012 nCloth animation to Realflow.


I have have made a dynamic simulation of some ncloth in maya and i would love to get that animation in to realflow.
I have the animation cached but it seems like i cant export it in an SD file. I have tried to bake the animation with the “shapes” checkbox checked but it did not work. The mesh is triangulated.
Is there a good workflow for getting the sim in to realflow or maybe bake the vertex animation so RF can import it correctly.
Im using RF 5.0.0 and the plugin for maya.

Thank you!


Hmm, I made a script to bake nCloth (or any animation pretty much) to a blendShape. You just have to make sure that your key frames are set to linear, or after you use it, open the graph editor on the blend shape and adjust the curve to make it linear, otherwise it will throw off the timing.

I never tried bringing in a blendShape to Realflow, but let me know if it works for you. Here is the script, just copy and paste in script editor or on a shelf button should work:

//Blend Bake script:
global proc blendBake(int $numFramesBlendBake)
displaySmoothness -divisionsU 0 -divisionsV 0 -pointsWire 4 -pointsShaded 1 -polygonObject 1;
subdivDisplaySmoothness -smoothness 1;
global string $blendBakeWindow;
if (`window -exists $blendBakeWindow`) deleteUI $blendBakeWindow; //Checks for and deletes existing window
string $dupObjs[] = `ls -sl`;  //Creates array with selected object.
string $blendObj = $dupObjs[0]; //Makes object a string.
int $i = 0;
int $startTime = `currentTime -q`;  //Stores current time for later.
for ($i = 0; $i<$numFramesBlendBake; $i++) //Will go however many frames specified.
    currentTime -edit (`currentTime -q` +1); //Forward 1 frame
    duplicate -rr; //duplicates selected object.
//Next 3 lines create an array with duplicated objects, then adds them to the end of
//the first array, $dupObjs[]
    string $newDupObjs[] = `ls -sl`;
    string $newDupObj = $newDupObjs[0];
    $dupObjs[size($dupObjs)] = ($newDupObj + "");
    setAttr ($newDupObjs[0] + ".visibility") 0;
    select $blendObj; //Selects the original object so it can be duplicated next frame.

int $endBakeTime = `currentTime -q`; //stores time of animation's end for blendshape keyframe
currentTime -edit $startTime; //Resets time to start of animation
duplicate -rr $blendObj; //Duplicates original object so animation isn't deleted

//Once again the next 3 lines add the duplicated object to the end of the $dupObjs array
string $newDupObjs[] = `ls -sl`;
string $newDupObj = $newDupObjs[0];
$dupObjs[size($dupObjs)] = ($newDupObj + "");

//these next fewlines reorder the selection for the blendshape
select $dupObjs;
select -d $dupObjs[0];
select -add $dupObjs[(size($dupObjs)-1)];

//creates blendshape, and deletes excess objects.
blendShape -origin world -ib -n "bakedAnimation";
string $blendAttName = $dupObjs[(size($dupObjs)-2)];
select -d $dupObjs[(size($dupObjs)-1)];

//adds keyframe at the in and out point of the animation
select $dupObjs[(size($dupObjs)-1)];
string $findBlendNode[] = `listHistory`; //selects blendshape node
select $findBlendNode[1];
setKeyframe -at $blendAttName -v 0;
setKeyframe -at $blendAttName -t $endBakeTime -v 1;
select $dupObjs[(size($dupObjs)-1)]; //re-selects object
rename ($dupObjs[(size($dupObjs)-1)]) ("BAKED " + ($dupObjs[(size($dupObjs)-1)]));

//Inserts number of frames from UI into blendBake global proc
global proc insertBlendBake()
    global string $blendBakeBtn;
    global string $numFramesBakeInt;
    int $numFramesBlendBake = `intFieldGrp -q -v1 $numFramesBakeInt`;
    string $blendBakeObjs[] = `ls -sl`;
    int $i = 0;
    string $blendBakedObjs[] = `select -cl`;
    string $blendBakedSelection[] = `select -cl`;
    for ($i = 0; $i<size($blendBakeObjs); $i++)
     select $blendBakeObjs[$i];
     $blendBakedObjs = `ls -sl`;
     $blendBakedSelection[$i] = $blendBakedObjs[0];
     select $blendBakedSelection;


//creates window
global string $blendBakeWindow;

if (`window -exists $blendBakeWindow`) deleteUI $blendBakeWindow; //Checks for and deletes existing window

//Base form
string $blendBakeWindow = `window -title "Blend Bake" -widthHeight 200 100` ;
     string $blendBakeForm = `formLayout -numberOfDivisions 100`;
          string $blendBakeBtn = `button -label "Blend Bake" -w 70 -h 30 -bgc .3 0 0 -command insertBlendBake`;
          string $numFramesBakeInt = `intFieldGrp -cw1 80 -cw 2 45 -label "Number of frames to bake:"
                   -cal 1 "left"`;
//Arranges content                   
     formLayout -edit
          -attachForm $numFramesBakeInt "top" 25
          -attachForm $numFramesBakeInt "left" 2
          -attachForm $blendBakeBtn "bottom" 5
          -attachForm $blendBakeBtn "left" 10
          -attachForm $blendBakeBtn "right" 10

showWindow $blendBakeWindow;


Awesome, thank you. Im going to try it out tomorrow.


OK yeah let me know if you have questions about it, but you just start at the frame you want to start at, select the objects you want to bake, and enter how many frames to bake after you run the script. Then it makes a copy with the baked animation.

Let me know if it works in Realflow for you, I’ve had an idea brewing that involves nCloth and Realflow, so I’d love to know.



I have try this way,it works.I cache the cloth,display it’s inputmesh,give it with the cache ,then export to the SD file ,import to realflow,it working!!Ha Ha!!!


Nice lil script! :smiley:


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.