Jump to content
ykcosmo

export houdini animation to maya

Recommended Posts

I got now a good script to import obj sequenzes into maya

its a script from tonytouch

global proc loadOBJsequence(string $directory)

{

int $startframe = 1;

string $file_list[] = `getFileList -folder ($directory + "/") -fs "*.obj"`;

for ($i=0;$i<`size $file_list`;$i++)

{

file -import -options "mo=0" ($directory + "/" + $file_list[$i]);

rename "polySurface1" ("importObjSequence_" + $i);

setKeyframe -at visibility -t ($startframe + $i) -v 1 ("importObjSequence_" + $i);

setKeyframe -at visibility -t ($startframe + $i -1) -v 0 ("importObjSequence_" + $i);

setKeyframe -at visibility -t ($startframe + $i +1) -v 0 ("importObjSequence_" + $i);

}

}

loadOBJsequence("c:/temp/OBJfolder");

thank you for sharing this script. i did a simple sphere animated on TY.(50 secs) append a rop output(i don't remember exactly but it isthe last one on the list) even there is no obj in the list i just type in obj and manage to get obj sequence. no problem.

i import these sequence to maya via your script. but it is blinking. 12,24,48 frames seems to be problematic. do you have any suggestions?

Share this post


Link to post
Share on other sites

I've been experimenting with a couple of other ways of bringing animation from Houdini to Maya which is using CHOPs to write out the animation, and then bring back into Maya, so far it's a bit teedious and repetitive, but looking at finding a way of doing it faster.

Share this post


Link to post
Share on other sites

These past couple of days i've been looking at this problem and been thinking on 2 solutions for this sort of problem, one that i know works is exporting out the channels using CHOPs and then bringing them into Maya via a script which isn't that complicated, but the problem with this method is that it's slow and tedious, that you have to assign it back to all the objects animated.

A better solution to that would be to automate the assignment procedure by naming your channel data files correctly and dump them into a folder and have Maya go through a list of reading those files and assigning the keys from the files to them.

That method works, but it also creates another problem which is that it'll set a keyframe to all the frames, so what now be best to do is create a script that will read the animation keys in a smart fashion, instead of keying every frame values, have it create more refine curves by not keying the frames that the values stay the same.

I've been contemplating with this idea for a while now and there are many possibilities.

Share this post


Link to post
Share on other sites

i got a new script

it works with blendshapes

global proc loadOBJsequence(string $directory)

{

int $startframe = 1;

string $file_list[] = `getFileList -folder ($directory + "/") -fs "*.obj"`;

string $group = `group -em -n "Blendshapegroup"`;

for ($i=0;$i<`size $file_list`;$i++)

{

file -import -options "mo=0" ($directory + "/" + $file_list[$i]);

rename "polySurface1" ("importObjSequence_" + $i);

select -r importObjSequence_0;

blendShape -frontOfChain -tc 0;

blendShape -e -tc 0 -t importObjSequence_0 ($i) ("importObjSequence_" + $i) 1 importObjSequence_0;

parent ("importObjSequence_" + $i) $group;

}

int $numBlendshapes = `size $file_list`;

int $frameNum;

for( $frameNum = 0; $frameNum < $numBlendshapes; $frameNum++)

{

currentTime $frameNum;

int $bshapeNum;

// fur alle auf 0 keyen

for( $bshapeNum = 0; $bshapeNum < $numBlendshapes; $bshapeNum++)

{

setAttr ("blendShape1.importObjSequence_" + $bshapeNum) 0;

setKeyframe ("blendShape1.importObjSequence_" + $bshapeNum);

}

setAttr ("blendShape1.importObjSequence_" + $frameNum) 1;

setKeyframe ("blendShape1.importObjSequence_" + $frameNum);

}

}

loadOBJsequence("c:/grafik/3d_szenen/houdini/meshtest");

Share this post


Link to post
Share on other sites

Does it work for changing topology? Say, in Houdini I animated and Generation of a Lsystem, can it be exported to Maya? Thanks!

Share this post


Link to post
Share on other sites

I mean, I did try, but it doesn't work. Don't know whether I have used the script correctly or not. Thanks!

Share this post


Link to post
Share on other sites

For geometry with chaning poing count over time i would do something like this ( assume we ignore the Maya API to streamline the task ):

export the geometry per frame from Houdini as .obj file sequence.

create a reference in maya and point to this sequence of files.

script the path/file reference string to switch the files according to frame number.

create an empty mesh node.

each time when reloading the reference script_connect it's outMesh to the inMesh of this empty mesh node ( or maybe once done, maya keeps the connection - cannot remember anymore how exactly it worked, but either way it is not a problem ).

This workflow creates a stable point ( the mesh node ) from where to start building your graph network. It's like the fileSOP in houdini, but little clumsy.

As far as i can remember some version(s) of Maya had problem directly referencing .obj files, if you have the bad luck of using one of them, you will need to convert the .obj sequence to .mb or .ma format.

... problems with motion blur ...

Edited by peship

Share this post


Link to post
Share on other sites

I got now a good script to import obj sequenzes into maya

its a script from tonytouch

global proc loadOBJsequence(string $directory)

{

int $startframe = 1;

string $file_list[] = `getFileList -folder ($directory + "/") -fs "*.obj"`;

for ($i=0;$i<`size $file_list`;$i++)

{

file -import -options "mo=0" ($directory + "/" + $file_list[$i]);

rename "polySurface1" ("importObjSequence_" + $i);

setKeyframe -at visibility -t ($startframe + $i) -v 1 ("importObjSequence_" + $i);

setKeyframe -at visibility -t ($startframe + $i -1) -v 0 ("importObjSequence_" + $i);

setKeyframe -at visibility -t ($startframe + $i +1) -v 0 ("importObjSequence_" + $i);

}

}

loadOBJsequence("c:/temp/OBJfolder");

thanks for this script

Share this post


Link to post
Share on other sites

thanks for this script

..or how to revive a thread started 9 years ago.

By the way, nowadays I'd suggest using alembic to transfer geometries between different packages.

I did it on a few projects with great results.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×