HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SOHO: Simple Examples

Example Files:

SOHO: Installing Examples

In $HFS/toolkit/samples, you should find a SOHO sub-directory. This contains

The .py Python files need to be installed in the HOUDINI_PATH, in the soho subdirectory. The OTL file can be loaded on the command line (or from the File menu after Houdini has started). For example, on Linux:

% cd $HOME/houdini$VERSION
% mkdir soho
% cp $HFS/toolkit/samples/SOHO/*.py soho
% cd $HFS/toolkit/samples/SOHO
% houdini hello.otl

After starting Houdini with the OTL, there should be a new output driver "Hello SOHO".

To create your own output driver, choose "New Operator Type" from the File menu in Houdini.

  • Choose "Output Driver Type".
  • Add a string parameter named soho_program
  • Add an integer parameter soho_outputmode and set it's default value to 2.

SOHO: Hello World

This example is about as basic as you can get.

# Simple "hello world" Python script
# On Linux, this will print to the terminal where Houdini was started.
# If started graphically, it's unclear where the output goes
print 'Hello world'

If you create a Hello SOHO operator in Houdini, make sure the soho_program parameter is set to Hello1.py, you should be able to hit the render button on the output driver and see "Hello world" printed out.

If you get an error on the output driver saying that there was "no SOHO program" found this means that the output driver was unable to find the Hello1.py program.

  • Make sure that the Hello1.py is found in the soho sub-directory in the HOUDINI_PATH. You can do this from within a Houdini textport (or from hbatch) running:
    hscript-> echo `findfile("soho/Hello1.py")`
    which should print out the full path to the file.
  • Alternatively, you can specify a full path to Hello1.py (i.e. "./Hello1.py")

SOHO: Hello World (Using HOM)

Hello2.py is a very minor extension to Hello1.py. Instead of using the Python print statement, we use HOM to call hou.ui.displayMessage()

SOHO: Object Traversal

Hello3.py shows how to build a SOHO scene and traverse the objects in the scene. The scene traversal will

  • Flatten all instances (including point instances)
  • Handle DOP instances
  • Filter objects based on display flags and dimmer channels (lights)

SOHO: OpenGL Example

There is a more complete factory example shipped with the Houdini. In $HFS/houdini/soho/, you should find OGL.py. This example uses the pygame and OpenGL Python modules to open a window and render lit object geometry.

This example performs object parameter evaluation and also shows how to access geometry. You can find more information on these functions in HDK_SOHO or by examining HDK_SOHO_API.