Python Resources

Updated on July 16  2014

Python In Houdini Examples

Deborah R. Fowler



Python in Houdini Examples

Updated May 9  2013
Updated Sept 30  2016

The previous section (Python in Houdini) outlined the where (getting the code into Houdini) and the how (hou syntax). This page provides some examples.


Python in a Font node - hip example file here. The key to the solution found on sidefx forum post here.


Phyllotactic Pattern - described here and seen executed in mel etc. is given here as a python in Houdini example.

The final version with top level controls is here. This uses the addSpareParmTuple command which was made clearer thanks to an odforce posting.  Hip file final result here or if you'd prefer to import and run, final .py file here.

Here is another example using python expressions: phyllotaxisWithPythonExpressions.hipnc


Spiral Staircase - described here and seen executed in mel, is given here as a python in Houdini example.

A simple houdini version (hipnc file) - one with a few more details.
A simple python scripted version (hipnc file or python script)
.


Mocap data parsing
- related to Exercise 3 for 705 is motion capture data parsing. Here are some simple examples of using the copy node (for example, a mace). You must create your own commented python script as the first part of this exercise.

This example is modified slightly from Nate Usiak's work in VSFX 705 in 2012
and inspired by Malcolm Kesson's site www.fundza.com.

To process data into a format suitable for Houdini a script written by Nate Usiak is given here.

This takes data from ascii txt format as found at http://accad.osu.edu/research/mocap/mocap_data.htm.
Thanks to the Motion Capture Lab of the Advanced Computing Center for the Arts and Design, Ohio State University.
This quarter, data from bvh format will be used.

 
Once that data is parsed ...

To take the resulting data into Houdini you must create a digital asset.

 

1. File->New Operator Type – brings up a dialogue box.

           

2. Hit Accept – an Edit Operator Type Properties window appears

            In the Basic tab be sure to set Minimum Inputs and Maximum Inputs to zero.

                        set the Label to be something unique (maybe include your name)

            In the Parameters tab set up two variables, one for the data files, one for velocity

                        (these parameters will be used in the code tab – they must match

                        I’ve used mocapFiles and velocityScale)

            In the Code tab place the script (courtesy of Nate Usiak found here)

                        make sure your parameters for source_file and velocity_scale match the code

                        ie. what is in quotes should be the names you used above ie. mocapFiles and velocityScale

 

3. Throw down a geo node

See my powerpoint for step by step screensnaps

A similar technique is used with python parsing and into mel. The sample script is here (by Sorya Serei)