This will be a quick little update. Everyone knows each 3D package has their strengths and weaknesses. Like Maya is super flexible but horrible with simulations, and Houdini is amazing with simulations but you can pretty much forget about UV's and keyframe character animation of anything more than 2 bones. So artists end up transferring assets from one package to another one. For instance, sending an obj sequence from Houdini to Maya can become a horrendous task. Houdini reads and writes files without saving them in its own memory or scene files which boosts its performance. In the mean while Maya needs each obj file to be absorbed into its memory and scene file which can easily bump the size of a scene to GBs. Here is a little 2 liner for you to make Maya read those obj files per frame and not absorb them:

string $frame = ( "/path/to/the/obj/sequence/" + `currentTime -query` + ".obj" ); file -loadReference "sphereRN" -type "OBJ" -options "mo=0" $frame;

This assumes that the name of the Reference is sphereRN and the obj sequence is not padded with zeroes. Below is a sample, you will have to open the expression editor, find the expression and edit the path to your extracted folder.

QUICK UPDATE

This is long over due.

Turns out this method will fail when used with batch render as pointed out by Jacob Niedzwiecki.

Simply put, root of the problem is that the currentTime function cannot query the frame number during a batch or command line render. When set by the expression editor to be evaluated always, currentTime looks at the GUI time slider for input.

Thanks to Jacob for pointing this error out :) and also for finding a very elegant and simple solution for it as well. What I had in mind for a fix was overly complicated.

What follows is his solution to the problem. But first a little explanation on why this solution actually works.

Maya allows for scripts to run before render jobs, before frames, after frames, and after render jobs. These can be set at the Render Globals window. Parameter names are Pre render MEL, Pre render frame MEL, and so on. These parameters are MEL scripts that are set to run at specified times during a render or a batch render or a command line render.

When the same script is set to be evaluated always by the expression editor and also as a Pre render frame MEL script, it will update both the viewport and the renderer with the correct file name for the frame.

So to iterate again, the solution is to copy and paste the exact same script to Pre render frame MEL parameter in the Render Globals window.

Previous Post Next Post