Harmony Write Nodes

With this recent Harmony gig, the studio is compositing in AfterEffects and wants each element rendered out separately. Setting up each scene to have each element have a write node would be a drag, so I whipped up a cheap and nasty little script to add them. It goes something like this:

function LH_addWriteNodes() {
    // This will add Write nodes to every selected node.
    MessageLog.trace( “===================” );

    var n = selection.numberOfNodesSelected();

    if (n <= 0) {
     MessageBox.warning( “Please select the nodes you add Write nodes to!”, MessageBox.Ok, MessageBox.NoButton);
     } else {

     // start the undo
     scene.beginUndoRedoAccum(“Add write nodes”);

     var i;

     for (i=0; i<n; ++i)
     {
         var selectedNode = selection.selectedNode( i );
         MessageLog.debug( node.type( selectedNode ) );
         if ( ( node.type( selectedNode ) == “READ” ) || ( node.type( selectedNode ) == “GROUP” ) )
         {
         var nodeName =  node.getName( selectedNode );
         var newAdd = node.add( node.root(), nodeName + “_Write”, “WRITE”, node.coordX( selectedNode ) + 5, node.coordY( selectedNode ) + 60, 0);
         MessageLog.trace( newAdd );

         // create filepath
         var rootPath = “//Path/to/output”;
         var sceneName = scene.currentScene();
         var shortSceneName = sceneName.substring( 0, sceneName.length – 3 );
         var writeNodePathLocation = rootPath + shortSceneName + “/” + nodeName + “/” + shortSceneName + “_” + nodeName + “_”;

         // set write node properties
         node.setTextAttr( newAdd, “DRAWING_TYPE”, 0, “TGA4” );
         node.setTextAttr( newAdd, “LEADING_ZEROS”, 0, “3” );
         node.setTextAttr( newAdd, “DRAWING_NAME”, 0, writeNodePathLocation );

         // Connect the new Write node to the Parent
         node.link( selectedNode, 0, newAdd, 0);
         }
     }

     // end the undo
     scene.endUndoRedoAccum();
     }
}

Please let me know if you find this useful!

%d bloggers like this: