HDK_SOHO_API Namespace Reference

Documentation for SOHO API (documentation only). More...


Functions

bool initialize (fpreal render_time, const char *camera_path)
 Initialize the SOHO scene.
void finalize ()
 Reset the SOHO scene.
void message (int severity, const char *text)
 Add a message, warning or error to the output driver.
bool addCandidates (fpreal render_time, const char *geometry_pattern, const char *light_pattern, const char *fog_pattern, const char *geometry_parm="soho.visibleobjects", const char *light_parm="soho.visiblelights", const char *fog_parm="soho.visiblefog", bool parameter_filtering=true, bool remove_objects=false)
 Add or remove objects from the SOHO scene.
void lockCandidates ()
 Finalize the object selection made by addCandidates().
FILE * getFile (int descriptor)
 Get SOHO file descriptors.
void indent (int bump=0, text="", comment="#", close_comment="")
 Output indented text on the output stream.
void printArray (const char *prefix, PyObject *list, const char *suffix)
 Print an array to the output stream.
const char * arrayToString (const char *prefix, PyObject *list, const char *suffix)
 Print an array to a string object.
void storeObjectData (int handle, const char *name, void *data)
 Store blind data on a SOHO object.
void * getObjectData (int handle, const char *name)
 Get blind data from a SOHO object.
void * clearObjectData (int handle, const char *name,...)
 Clear blind data from a SOHO object.
PyObject * evaluate (PyObject *parameters, fpreal time, int handle)
 Evaluate parameters on an object.
UT_StringArray processShaderString (const char *shader_string, const UT_Options &options)
 Process a shader, evaluating VOP or op: references.
void pushOverrides (const UT_Options &options)
 Push a set of parameter overrides.
void popOverrides ()
 Pop the override stack (see pushOverrides());.
PyObject * newIterator (const char *type, fpreal time, int object_handle, const char *pattern_override, const char *category_override)
 Start iterating over a list of objects.
int nextIterator (PyObject *iterator)
 Proceed to the next iteration of an iterator.
int gCreate (const char *path, fpreal cook_time)
 Create a geometry object.
void gDelete (int geo_handle)
 Release a geometry handle.
PyDictObject * gPartition (int geo_handle, const char *style, PyObject *option)
 Partition geometry into new geometry objects.
int gTesselate (int geo_handle, UT_Options &options)
 Tesselate geometry into polygons (Houdini 11.0 and greater).
int gAttribute (int geo_handle, const char *owner, const char *name)
 Look up a geometry attribute.
PyListObject * gValue (int geo_handle, int attribute, int element)
 Evaluate a geometry attribute.
PyListObject * gVertex (int geo_handle, int attribute, int primitive, int vertex)
 Evaluate a geometry attribute by (primitive,vertex).
bool gSaveAll (int geo_handle, const char *filename, const UT_Options &options)
 A short-cut to save geometry to a known format.


Detailed Description

Documentation for SOHO API (documentation only).

The SOHO API is currently only available through a Python API. The functions are documented in the help() of the soho module. However, this document provides documentation in a more usable form.

Warning:
These functions do not exist in a C++ API


Function Documentation

bool HDK_SOHO_API::addCandidates ( fpreal  render_time,
const char *  geometry_pattern,
const char *  light_pattern,
const char *  fog_pattern,
const char *  geometry_parm = "soho.visibleobjects",
const char *  light_parm = "soho.visiblelights",
const char *  fog_parm = "soho.visiblefog",
bool  parameter_filtering = true,
bool  remove_objects = false 
)

Add or remove objects from the SOHO scene.

Parameters:
render_time 
The time to be used for filtering evaluations
geometry_pattern 
An object name pattern used to match geometry objects. Only objects which match the name pattern will be considered for the operation.
light_pattern 
An object name pattern used to match light objects.
fog_pattern 
An object name pattern used to match fog objects.
parameter_filtering 
When selecting objects for addition to the scene, turning on parameter_filtering will cause parameter evaluation to before acceptance of an object.
  • For geometry objects: Evaluate the display flag & display channel
  • For fog objects: Evaluate the display flag & display channel
  • For light objects: Evaluate the "dimmer" channel. If 0, skip the light.
remove_objects 
Remove selected objects from the scene (instead of adding to the scene)
geometry_parm 
The name of the parameter that was evaluated in order to obtain geometry_pattern.
light_parm 
The name of the parameter that was evaluated in order to obtain light_pattern.
fog_parm 
The name of the parameter that was evaluated in order to obtain fog_pattern.
This function will expand all instance objects (including point instancing).

Sub-network Filtering
When evaluating a sub-network object which matches the candidate pattern, the subnet_filter parameter is evaluated on the sub-network. This parameter can have three possible values

  • all
    All children of the sub-network are included in the SOHO scene.
  • pattern
    The parameter subnet_pattern is evaluated and only children which match that pattern are selected.
  • display (default)
    Use the parameter_filtering criteria for object selection.

See also:
lockCandidates()

const char* HDK_SOHO_API::arrayToString ( const char *  prefix,
PyObject *  list,
const char *  suffix 
)

Print an array to a string object.

This is a convenience function to print an array of values to the SOHO output stream. In Python code, this is equivalent to:

                def arrayToString(prefix, value, suffix):
                    precision = soho.getDefaultedInt("soho_precision", [12])[0]
                    result = prefix
                    for i in value:
                        if type(i) == float:
                            result += ' %.*g' % (prec, i)
                        else:
                            result += ' %s' % repr(i)
                    result += suffix
                    return result
See also:
printArray()

void* HDK_SOHO_API::clearObjectData ( int  handle,
const char *  name,
  ... 
)

Clear blind data from a SOHO object.

SOHO objects are referenced by handles in the Python API. There is a class wrapped around the integer handle, but multiple instances of the class may be created for the same object. SOHO provides a way to store blind data on the object.

Multiple entries can be cleared from the dictionary at one time.

The data is stored in a dictionary.

See also:
storeObjectData(), getObjectData()

PyObject* HDK_SOHO_API::evaluate ( PyObject *  parameters,
fpreal  time,
int  handle 
)

Evaluate parameters on an object.

The evaluate() function is the work-horse in SOHO. The function takes a Python list or dict of parameter objects and returns a list or dict of evaluated parameters. The parameter object should have the following attributes:

  • Key: A unique name for the parameter (used in the returned dict)
  • Houdini: The name of a Houdini parameter to evaluate
  • Type: The type of data expected (i.e. how the parameter should be evaluated). Possible values are: 'float', 'bool', 'int', 'string', 'shader', 'bounds', 'oplist'.
  • Default: Optional default value
  • SkipDefault: If the Houdini parameter is at it's default value, and this attribute is True, then, the parameter will not be returned in the resulting list or dict.

There is a sample class object defined (SohoParm) in soho.py which is used throughout the factory Python scripts.

After evaluation, the parameter object will have a new attribute Value which stores the resulting value. The Value attribute will always be a list/tuple, even if the parameter is a scalar.

For example:

           def getDefaultedInt(object_handle, name, default_value):
                # Create a parameter list.  Specify the default value to be
                # returned if the parameter cannot be evaluated.
                parmlist = [ SohoParm(name, 'int', default_value, False) ]
                # Evaluate the parameter list
                parmlist = evaluate(parmlist, None, object_handle)
                return parmlist[0].Value
This could also be implemented as:
           def getDefaultedInt(object_handle, name, default_value):
                # Create a parameter list.  Specify the default value to be
                # returned if the parameter cannot be evaluated.
                parmlist = [ SohoParm(name, 'int', [], True) ]
                # Evaluate the parameter list.  If the evaluation fails, then
                # return the default_value.
                if not evaluate(parmlist, None, object_handle):
                    return default_value
                return parmlist[0].Value

Parameters:
parameters 
A Python list or dict of parameter objects
time 
The evaluation time. If no evaluation time is specified, the time given by initialize() is used.
handle 
An object handle identifier. This may be 0 to evaluate parameters on the output driver (i.e. global parameters).
Returns:
If parameters were evaluated, returns a list or dict of parameters with a Value attribute set to the evaluated results. Otherwise, returns None
Note:
SOHO has intrinsic parameters. These intrinsic parameters are used to evaluate internal state of SOHO. It's possible to get a list of all tokens by evaluating "state:alltokens" or "state:allgeotokens" (to get geometry specific tokens). Some common tokens include:
  • state:alltokens
    A list of all intrinsic parameters known to SOHO
  • state:allgeotokens
    A list of all geometry intrinsic parameters known to SOHO
  • state:precision
    Floating point precision
  • state:houdiniversion
    The Houdini version string
  • state:time
    The time passed in initialize()
  • objlist:camera
    The list of camera objects
  • objlist:light
    The list of light objects
  • objlist:instance
    The list of instance/geometry objects
  • objlist:lightmask
    The lights affecting an object (includes category selections and bundle evaluations).
  • object:name
    The object name
  • object:soppath
    The object's render SOP
  • object:creator
    The object's creator object
  • space:world
    The object's world space
  • space:local
    The object's local space

void HDK_SOHO_API::finalize (  ) 

Reset the SOHO scene.

This function will re-initialize the SOHO scene with an empty scene. The output driver object will be kept in the scene.

Note:
This function is called automatically at the completion of the Python script.

int HDK_SOHO_API::gAttribute ( int  geo_handle,
const char *  owner,
const char *  name 
)

Look up a geometry attribute.

Attributes in SOHO are accessed using integer handles. Valid handles have values greater than 0. The gAttribute() function will query geometry to find a handle to the named attribute. This handle can then be used by gValue() or gVertex() to evaluate the value from the geometry.

SOHO maintains a list of intrinsic attributes which can be used to access information about the topology of the geometry, primitive properties or other intrinsic attributes which aren't tied directly to a user attribute. You can get a list of all geometry tokens using the evaluate() function (with the 'state:allgeotokens' parameter name).

When the parameter owner is "geo:attrib", the attribute handle can be used to query information about attribute handles. The following intrinsic attributes are supported in this case:

  • 'geo:storage'
    Evaluate the storage type of the attribute (returns 'int', 'float' or 'string')
  • 'geo:vectorsize'
    Evaluate the tuple size of the attribute.
  • 'geo:allstrings'
    Return a list of all the unique strings associated with the attribute. This may return strings which aren't actually referenced in the geometry, but are stored on the attribute.

Example:

                # Find the P point attribute and print it for the first 10
                # points
                P = gAttribute(geo_handle, 'geo:point', 'P')
                for i in range(10):
                        print i, gValue(geo_handle, P, i)

                # Find the "intrinsic" attribute for the primitive type name
                # and print it out for the first 10 primitives
                pname = gAttribute(geo_handle, 'geo:primitive', 'geo:primname')
         for i in range(10):
                        print i, gValue(geo_handle, pname, i)

         # Find an attribute to query the vector size of an attribute
                # Use this attribute to print out the vector size of the P and
                # pname attributes.
                a_vsize = gAttribute(geo_handle, 'geo:attrib', 'geo:vectorsize)
                P_size = gValue(geo_handle, a_vsize, P)
                primname_size = gValue(geo_handle, a_vsize, pname)
                print 'P[%d] pname[%d]' % (P_size, primname_size)

Parameters:
geo_handle 
The geometry handle created with gCreate()
owner 
The owner of the attribute. This may be one of
  • 'geo:point'
    A point attribute
  • 'geo:prim'
    A primitive attribute
  • 'geo:vertex'
    A vertex attribute
  • 'geo:global'
    A global (or detail) attribute
  • 'geo:attrib'
    An attribute of an attribute. Only supports intrinsic attributes.
  • 'geo:meta'
    An attribute used to query the metaball expression associated with the geometry.
name 
The name of the attribute to look up. This may be the name of an intrinsic attribute.

int HDK_SOHO_API::gCreate ( const char *  path,
fpreal  cook_time 
)

Create a geometry object.

Parameters:
path 
The Houdini path to a SOP object. This SOP's geometry will be evaluated. You can find the SOP path for an object by evaluating
                path = obj.getDefaultedString('object:soppath', time, [''])[0]
                geo_handle = gCreate(path, time)
                if geo_handle < 0:
                    print 'Error getting geometry:', path
cook_time The time used to evaluate the SOP's geometry
Returns:
The function returns an integer handle which can be used to reference the geometry. Handles less than 0 indicate errors evaluating the geometry.
Note:
This is wrapped in the SohoGeometry class (sohog.py)
Warning:
It is important to release the geometry with gDelete()

void HDK_SOHO_API::gDelete ( int  geo_handle  ) 

Release a geometry handle.

Release the geometry associated with the handle. The handle should have been created with gCreate().

Note:
This is wrapped in the SohoGeometry class (sohog.py)

FILE* HDK_SOHO_API::getFile ( int  descriptor  ) 

Get SOHO file descriptors.

The SOHO output driver evaluates the soho_outputmode parameter, and based on its value will create 2 internal file descriptors.

Parameters:
descriptor @
  • 1 will return the file descriptor tied to the output stream (i.e. the disk file specified by soho_diskfile or the pipe command specified by soho_pipecmd)
  • 2 will return the file descriptor tied to the error stream. Data written to this stream will be added to the output driver as an error message. Values other than 1 or 2 return NULL.

void* HDK_SOHO_API::getObjectData ( int  handle,
const char *  name 
)

Get blind data from a SOHO object.

SOHO objects are referenced by handles in the Python API. There is a class wrapped around the integer handle, but multiple instances of the class may be created for the same object. SOHO provides a way to store blind data on the object.

The data is stored in a dictionary.

See also:
storeObjectData(), clearObjectData()

PyDictObject* HDK_SOHO_API::gPartition ( int  geo_handle,
const char *  style,
PyObject *  option 
)

Partition geometry into new geometry objects.

Partitioning geometry splits one geometry object into a dictionary of geometry objects. Each element of the dictionary is composed of a sub-set of the primitives of the original geometry. The dictionary values are the handles associated with the geometry objects. You must call gDelete() on these handles.

There are four styles of partitioning currently implemented.

geo:partgroup
In this case, the option parameter refers to a primitive group name. All primitives in that group are returned in a new geometry object.

geo:partattrib
In this case, the option parameter refers to a string attribute. The geometry is partitioned based on the values of the string. That is, all primitives which have the same string value are put into a single partition group. This approach can be used to partition geometry based on material assignments for example.

geo:partlist
This is the most flexible partitioning process. The option parameter in this case, refers to a list of strings. There should be one string for each primitive in the geometry. Each primitive will be placed in a partition named by the corresponding string. Python generator objects are accepted in this function.

geo:partenlarge
This is a special case partitioner which looks at edge connectedness of polygon sets. The option is ignored. The returned partition will contain a super-set of the original geometry which has additional polygons which were connected to the original geometry. This assumes that the geometry was part of a partitioned set.

Examples

                # Create a single partition with all the primitives in the
                # group named 'renderme'
                partition('geo:partgroup', 'renderme')

                # Partition the geometry into partitions based on the value of
                # the 'material' attribute.
                partition('geo:partattrib', 'material')

                # Partition the geometry into partitions based on a generator
                def generator(nprimitives):
                        for x in xrange(0, nprimitives):
                                if isprime(x):
                                        return 'prime'
                                else:
                                        return 'composite'
                partition('geo:partlist', generator(nprimitives))

Note:
This is wrapped in the SohoGeometry class (sohog.py)

bool HDK_SOHO_API::gSaveAll ( int  geo_handle,
const char *  filename,
const UT_Options options 
)

A short-cut to save geometry to a known format.

This method will call GU_Detail::save() to save the geometry to the given filename. If the filename is 'stdout.geo', 'stdout.bgeo' or 'stdout', the geometry will be saved to the SOHO output stream (as returned by getFile(1))

The options are passed to the GU_Detail::save() method and can be used to "tune" saving. Some common options include:

  • bool savegroups
  • bool savepointgroups
  • bool savepprimitivegroups

Warning:
All the geometry from the root geometry is saved, even if the geometry is the result of a gPartition() call. This behaviour may change in the future, and so it should not be relied upon.

int HDK_SOHO_API::gTesselate ( int  geo_handle,
UT_Options options 
)

Tesselate geometry into polygons (Houdini 11.0 and greater).

This takes source geometry and creates a tesselated version of the geometry. The tesselation is controlled using the options passed. For a current list of options, please see $HH/soho/soho.doc. However, some common options include:

  • tess:style
    Conversion style for geometry. The style should be one of 'lod' (tesselate based on level of detail) or 'div' (tesselate based on divisions). The default is 'lod'
  • tess:polysides
    The value should be an integer specifying the maximum number of sides of polygons. No polygon splitting will be performed if the value is less than 0. All polygons split will be guaranteed to be convex. Example:
                    geo1 = gCreate(path);
                    geo2 = tesselate(geo1, {'tess:style':'lod', 'tess:polysides':3})
    

PyListObject* HDK_SOHO_API::gValue ( int  geo_handle,
int  attribute,
int  element 
)

Evaluate a geometry attribute.

Parameters:
geo_handle 
The geometry handle created by gCreate()
attribute 
The attribute handle created by gAttribute()
element 
The number of the element to be evaluated. This integer is dependent on the attribute type, and it's the users responsibility to ensure that the value has the correct meaning. The meaning is based on the attribute owner type:
  • 'geo:point'
    element refers to the point number
  • 'geo:prim'
    element refers to the primitive number
  • 'geo:global'
    element is ignored.
  • 'geo:attrib'
    element is the attribute handle to query
  • 'geo:vertex'
    element is a tuple of integers (primitive, vertex). This uniquely identifies a vertex for evaluation.
  • 'geo:meta'
    element is the metaball expression (or sub-expression). 0 refers to the root expression.
Returns:
This function always returns a list of values. Even if the parameter is a scalar. This can lead to very subtle errors. For example, in the following code, nprims is a list object (not an int):
                nprim_handle = gAttribute(geo, 'geo:global', 'geo:primcount')
                nprims = gValue(geo, nprim_handle, 0)
                # Should be:                           vvv
                # nprims = gValue(geo, nprim_handle, 0)[0]
                #                                      ^^^

PyListObject* HDK_SOHO_API::gVertex ( int  geo_handle,
int  attribute,
int  primitive,
int  vertex 
)

Evaluate a geometry attribute by (primitive,vertex).

Parameters:
geo_handle 
The geometry handle created by gCreate()
attribute 
The attribute handle created by gAttribute()
primitive 
The primitive number for evaluation.
vertex 
The vertex number for evaluation
This function is equivalent to:
                gValue(geo_handle, attribute, (primitive, vertex))
Returns:
This function always returns a list of values. Even if the parameter is a scalar. See gValue()

void HDK_SOHO_API::indent ( int  bump = 0,
text  = "",
comment  = "#",
close_comment  = "" 
)

Output indented text on the output stream.

This is a convenience function to indent the SOHO output stream. In Python code, this is equivalent to:

                def indent(bump=0, text="", comment="#', close_comment=""):
                    global      theIndent
                    bump *= soho.getDefaultedInt("soho_indentstep", [4])[0]
                    if bump < 0:
                        theIndent += bump
                    sys.stdout.write("%*s" % (theIndent, ""))
                    if text:
                        sys.stdout.write(text)
                        if comment:
                            if bump < 0:
                                sys.stdout.write("\t %s } %s" % (comment, closecomment))
                            else:
                                sys.stdout.write("\t %s { %s" % (comment, closecomment))
                    if bump > 0:
                        theIndent += bump
Examples:
ROP/ROP_Dumper.C, and standalone/traverse.C.

bool HDK_SOHO_API::initialize ( fpreal  render_time,
const char *  camera_path 
)

Initialize the SOHO scene.

SOHO maintains an internal representation of the Houdini Scene. SOHO may filter some objects out of the render scene. It also flattens all instancing so that each instanced object is represented as a single SOHO object. This includes DOP instancing.

The camera path may be NULL, in which case there will be no camera in the scene and the scene will be considered to be contained by "/obj".

This function will also set the internal state by evaluating

  • soho_precision
    Output floating point precision, default := 12
  • soho_indentstep - Default := 4 Indent step for indent() function
  • soho_almostzero - Default := 0 Real numbers which have their value less than this tolerance will be output as 0 exactly.
  • soho_safename - Default := False Change object names to "safe" names. Safe names follow standard variable naming conventions, only alpha-numeric characters and the underscore ('_')
  • soho_autoheadlight - Default := True Automatically add a light at the camera's location if there are no lights in the scene.

The method will fail if the user specifes a camera path, but there is no corresponding camera in the Houdini scene.

When rendering from the viewport menu, this function will succeed even if the camera doesn't exist. See SOHO Overrides for details.

The global indent level is reset to 0.

void HDK_SOHO_API::lockCandidates (  ) 

Finalize the object selection made by addCandidates().

void HDK_SOHO_API::message ( int  severity,
const char *  text 
)

Add a message, warning or error to the output driver.

Depending on the severity, this function will add a message (information), a warning or an error to the output driver.

Parameters:
text 
Message text. This text will be added to the output driver as a message (information), warning or error depending on the severity.
severity 
Specify the severity of the message.
  • severity = 0
    Add text as information only (no warning or error)
  • severity = 1
    Add text as a warning and set the output driver's error state to a warning.
  • severity = 2
    Add text as an error, setting the output driver's error level to an error status. This will not terminate the Python program. To terminate, raise the exit exception:
     raise SystemExit 
    
    For example:
                sohoglue.message(0, "This is information")
                sohoglue.message(1, "This is a warning")
                sohoglue.message(2, "This is an error")
    
Note:
The maximum severity of all messages will be used to set the error status on the output driver.

PyObject* HDK_SOHO_API::newIterator ( const char *  type,
fpreal  time,
int  object_handle,
const char *  pattern_override,
const char *  category_override 
)

Start iterating over a list of objects.

Create an iterator object which allows iteration over a selection of objects in the SOHO scene.

Parameters:
type 
The type of iteration. This should be one of:
  • objlist:all - All objects in the scene
  • objlist:outputdriver - All output drivers (typically one)
  • objlist:camera - All cameras in the scene
  • objlist:light - All light objects in the scene
  • objlist:instance - All instance/geometry objects in the scene
  • objlist:fog - All fog objects in the scene
  • objlist:space - All transform space objects (null objects) in the scene
  • objlist:shop - All SHOP's referenced by objects in the scene
  • objlist:deletedlight - All lights deleted (IPR mode)
  • objlist:deletedinstance - All instance/geometry objects deleted (IPR mode)
  • objlist:deletedfog - All fog objects deleted (IPR mode)
  • objlist:dirtylight - All light objects changed (IPR mode)
  • objlist:dirtyinstance - All instance objects changed (IPR mode)
  • objlist:dirtyfog - All fog objects changed (IPR mode)
  • objlist:dirtyspace - All space objects changed (IPR mode)
  • objlist:lightmask - Lights affecting an object
  • objlist:shadowmask - Instance/Geometry objects blocking light from a light source
  • objlist:reflectmask - Instance/Geometry objects visible in reflections from an object
  • objlist:refractmask - Instance/Geometry objects visible in refractions from an object
  • objlist:unlightmask - Lights not affecting an object
  • objlist:unshadowmask - Complement of objlist:shadowmask
  • objlist:unreflectmask - Complement of objlist:reflectmask
  • objlist:unrefractmask - Complement of objlist:refractmask
time Evaluation time to evaluate the parameters controlling the selection
object_handle The lightmask, shadowmask, reflectmask, refractmask can all be evaluated on a per-object basis. The handle can be -1 to evaluate the parameters on the output driver (for example for 'objlist:light')
pattern_override Specify a pattern which filters objects based on object name. This defaults to "*".
category_override Specify a pattern which filters objects based on category tags/selection tags. This defaults to "*".
See also:
nextIterator()

int HDK_SOHO_API::nextIterator ( PyObject *  iterator  ) 

Proceed to the next iteration of an iterator.

Parameters:
iterator An iterator created by newIterator()
Iterates over the SOHO objects in the iterator, returning the object handle for the current object. An invalid handle (-1) is returned when the iteration is complete.

For example, to implement an iteration over all light sources in a SOHO scene as a Python generator:

                def allLights():
                        it = newIterator('objlist:light', None, None, None,None)
                        while True:
                                handle = nextIterator(it)
                                if result < 0:
                                        break
                                yield handle

void HDK_SOHO_API::popOverrides (  ) 

Pop the override stack (see pushOverrides());.

void HDK_SOHO_API::printArray ( const char *  prefix,
PyObject *  list,
const char *  suffix 
)

Print an array to the output stream.

This is a convenience function to print an array of values to the SOHO output stream. In Python code, this is equivalent to:

                def printArray(prefix, value, suffix):
                    precision = soho.getDefaultedInt("soho_precision", [12])[0]
                    sys.stdout.write(prefix)
                    for i in value:
                        if type(i) == float:
                            sys.stdout.write(' %.*g' % (prec, i))
                        else:
                            sys.stdout.write(' %s' % repr(i))
                    sys.stdout.write(suffix)
See also:
arrayToString()

UT_StringArray HDK_SOHO_API::processShaderString ( const char *  shader_string,
const UT_Options options 
)

Process a shader, evaluating VOP or op: references.

When a shader is defined by a VOP network, the VOP network may need to be processed for a valid shader to exist.

In addition, some shaders may have arguments which reference other assets in the .hip file (i.e. COP images). This function will also process arguments, scanning for 'op:' or 'opdef:' to determine whether assets have to be passed to the render script.

At the current time, scanning for op: is mantra/IFD specific.

Returns:
The function returns two strings.
  • result[0]
    The first string in the array returned is the mangled shader string. This may have the shader name changed (if the shader was defined by VOPs) or have parameter values changed (if they referred to COPs).
  • result[1]
    The second string contains data needed by rendering. This may contain compiled .vex object code for IFD, or other data depending on the rendering style set by the output driver (See SOHO Output Drivers)
Parameters:
shader_string 
The shader string to process
options 
A dictionary of options which tell processShaderString() how the shader string should be processed.
  • bool forcevop
    SOHO will output inline .vex code if it believes that mantra will not be able to load the shader code independently. This will happen if the VEX code is generated by an embedded VOP network for example. However, if Houdini believes that mantra will be able to load the VEX code from an OTL, it will skip inlining the VEX code. This option tells processShaderString() to forcibly embed VEX code regardless of what Houdini believes.
  • bool force_cop_embedding
    SOHO will embed an image defined by a COP if it believes that mantra will not be able to load the image independently. If Houdini believes that mantra will be able to load the image (i.e. from an OTL), it will skip embedding the COP image in the IFD. This option tells processShaderString() to forcibly embed image regardless of what Houdini believes.
Note:
processShaderString will also scan for CVEX shader references and process these arguments if needed.

void HDK_SOHO_API::pushOverrides ( const UT_Options options  ) 

Push a set of parameter overrides.

This function takes a dictionary of name/value pairs. When SOHO is asked to evaluate a parameter, it first checks to see whether the parameter is defined in the current overrides. If so, the value from the overrides is returned.

The overrides form a stack, and all pushed overrides are scanned when parameters are evaluated.

pushOverrides() and popOverrides() are wrapped in the PropertyOverride object (soho.py).

Note:
At the current time, only values which can be represented in a UT_Options object are processed properly.
See also:
popOverrides()

void HDK_SOHO_API::storeObjectData ( int  handle,
const char *  name,
void *  data 
)

Store blind data on a SOHO object.

SOHO objects are referenced by handles in the Python API. There is a class wrapped around the integer handle, but multiple instances of the class may be created for the same object. SOHO provides a way to store blind data on the object.

The data is stored in a dictionary.

See also:
getObjectData(), clearObjectData()


Generated on Mon Jan 28 00:30:26 2013 for HDK by  doxygen 1.5.9