Yin Yang

An experimental Micro-Film Project. Abstract portrayal of the tension between light & dark.

Ronald Fong Obj Sequence to Maya MEL

Obj Sequence to Maya

A quick and dirty way to load an .obj sequence in Maya and have each geometry’s visibility automatically keyed to show up at the frame they are supposed to show up. Wrote this script as an experiment, but don’t have time to make a UI, so I just commented on the two variables to change accordingly to your setup. Cheers!

Update [10 Feb 2020]: Made sure the import command explicitly points to the specified folder directory (Thanks Cody for pointing out that the script didn’t work for you!)

global proc rf_objSeqImport() {
string $folder = "C:/objImport/"; //Change the folder directory to the folder containing your .obj sequence
string $mesh = "Mesh"; //Change the word 'Mesh' to the name of the geometry that would be imported

string $objFiles[] = `getFileList -folder $folder -filespec "*.obj"`;
int $i = 0;
while ((size($objFiles[$i])) > 0){
    print ("Importing " + $objFiles[$i] + "... \n");
    file -import -type "OBJ"  -ignoreVersion -ra true -mergeNamespacesOnClash false -namespace ("objImport" + $i) -options "mo=1"  -pr  -importTimeRange "combine" ($folder + $objFiles[$i]);
    currentTime ($i+1) ; //visible on frame
    setAttr ("objImport" + $i + ":" + $mesh + ".visibility") 1;
    setKeyframe ("objImport" + $i + ":" + $mesh + ".v");
    
    currentTime $i ; //invisible before frame
    setAttr ("objImport" + $i + ":" + $mesh + ".visibility") 0;
    setKeyframe ("objImport" + $i + ":" + $mesh + ".v");
    
    currentTime ($i+2) ; //invisible after frame
    setAttr ("objImport" + $i + ":" + $mesh + ".visibility") 0; 
    setKeyframe ("objImport" + $i + ":" + $mesh + ".v");

    $i++;
};
}

rf_objSeqImport();
Reconnect attributes of textures and materials

Reconnect attributes textures and materials

Quick MEL script to quickly re-connect existing texture connections from one slot to another within multiple materials. To use, alter the script to determine the attributes to connect/disconnect, then select multiples materials and run the script.

As defaults, the script is set to get the first input node it can find, its outColor attribute, re-connect it to the material’s ambientColor attribute. Then, it disconnects that input node’s outColor attribute from the material’s color attribute.

It should work, but it’s admittedly a very sketchy script. Well, until I find time to improve it. Cheers!

global proc rf_reconnect(){
    string $sel[] = `ls -sl`;
    for ($item in $sel) {
        string $srccon[] = `listConnections -s 1 -d 0 $item`;
        connectAttr -f ($srccon[0] + ".outColor") ($item + ".ambientColor"); //Create New Connection
        disconnectAttr ($srccon[0] + ".outColor") ($item + ".color"); //Remove Old Connection
    }
}    

rf_reconnect();

Houdini Alembic to Maya with Geometry Separation

One way to export multiple geometries from Houdini to Maya and preserve the geometry separation is to make sure that the primitives have individual @name attributes before using the Merge SOP. Thereafter, ensure that the ROP Alembic Output has ‘Partition Mode’ set to “Use Shape Node Component of Path Attribute Value”, and ‘Partition Attribute’ set to “name”

Update on 14 Sep 2018: You can use a Name SOP to help sort the incoming geometry before the Merge SOP

Ronald Fong Houdini Alembic to Maya Geometry Preservation - ROP Alembic Outpuit Settings

When imported into Maya, Houdini alembic export will show up as a single transform with multiple shape nodes
In Maya, select the transform node and run this script to get unique transform nodes for each shape.

This way, you can do your material assignment like how we’d normally do in Maya, instead of trying to assign them to individual shape nodes. Cheers!

Ronald Fong Houdini Alembic to Maya Geometry Preservation - Shapes to Transforms

//Author: Ronald Fong
//Date: 11 Aug 2018
//Notes: When imported into Maya, Houdini alembic export often show up as a single transform with multiple shape nodes. However, we usually want a transform node per shape node in Maya.
//Usage: In Maya, select the transform node and run this script to get unique transform nodes for each shape. Cheers!

global proc rf_shapesToTransforms() {
    string $abcObj[] = `ls -sl`;
    string $shapes[] = `listRelatives -s $abcObj[0]`;
        for ($shape in $shapes) {
            select $abcObj;
            $newGeo = `duplicate -rr -un -n ($shape+"_GEO")`;
            string $newShapes[] = `listRelatives -s $newGeo`;
            for ($newShape in $newShapes) {
                if ($newShape != $shape) {
                    delete ($newGeo[0] + "|" + $newShape);
                }
                else if ($newShape == $shape){
                    rename ($newGeo[0] + "|" + $newShape) ($newShape+"_GEOShape");
                }
            }
        }
    delete $abcObj[0];
}

rf_shapesToTransforms();

Process

Using Houdini’s FLIP solver to model the Rayleigh–Taylor instability (after Lord Rayleigh and G. I. Taylor). It is an instability of an interface between two fluids of different densities which occurs when the lighter fluid is pushing the heavier fluid.

  • Houdini
  • Redshift

Behind-the-scenes

Most Recent Entries