Maya 2012 nCloth animation to Realflow.

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 08 August 2012   #1
Maya 2012 nCloth animation to Realflow.

Hello!
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!
 
Old 08 August 2012   #2
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)];
doDelete;

//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];
     blendBake($numFramesBlendBake);
     $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

     $blendBakeForm;
showWindow $blendBakeWindow;
 
Old 08 August 2012   #3
Awesome, thank you. Im going to try it out tomorrow.
 
Old 08 August 2012   #4
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.

Thanks!
 
Old 08 August 2013   #5
Originally Posted by sejnulla: Hello!
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!



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!!!
 
Old 08 August 2013   #6
Originally Posted by newguy4life: 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)];
doDelete;

//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];
     blendBake($numFramesBlendBake);
     $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

     $blendBakeForm;
showWindow $blendBakeWindow;


Nice lil script!
__________________

.

Reel - 3DInk.com
Filmography -IMDB
R&D - VIMEO

*please read- cyanbsl.blogspot.com/*
 
Old 08 August 2013   #7
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 09:00 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.