Foreach and Opfind
eharetea

Powerful searching with foreach and opfind.

This script using the opfind and foreach commands generates a list of all the mantra nodes, excluding the ones you don't want...hence the continue command, and creates a render script to disk. You can source this script with hscript shell using the source command.

Date Created:Friday December 29th, 2006 03:41 AM
Date Modified:Friday August 01st, 2008 01:34 PM

OPFIND AND FOREACH

/*

ah....the opfind command. My favorite. Think of the unix find command within houdini.

The -t flag is for type. To find out a type for a node, you can use optype command.

The -p is for the path to look in, without it, it looks everywhere.

Type "help opfind" in the textport for other flags.



The way to find the current unix path is upwd... pwd would return the houdini working path.
(ucd to navigate unix path, cd is to change path in houdini's hierchy.)

">>" appends to file, ">" would write over.

*/



foreach z (`run("opfind -t mantra -p /out")`)
 if($z=="/out/mantra1"||$z=="/out/mantra2")
  continue
 endif
echo -n render $z\;>>renderme
end