[SESI logo]

Houdini Development Toolkit - Version 6.5

Side Effects Software Inc. 2004

Surface Operators

SOP_Node Methods

The SOP_Node class is the base class for all surface operators. The class inherits from OP_Node which is the base class for all Houdini operators. See the sample SOPs for uses of the class.

Special Methods of Interest

  • cookMySop(OP_Context &)
    This function must be supplied by all subclasses. It is supplied with a context that describes the time that the geometry is to be cooked. Each SOP has a geometry detail pointer (gdp) associated with it. All access to the geometry is done through the GU_Detail class. The context passes in the time at which to cook and can be accessed through context.myTime.

  • inputGeo(int index, float t)
    This function returns a pointer to the input's geometry specified by index and cooked at time t.

  • duplicateSource(int index, float t, GU_Detail *other_gdp=0, int clean=1)
    This method duplicates one of the input sources specified by the index (0 to num inputs) at time t. It copies the geometry from the input into the gdp of the SOP.

    If the other_gdp is specified then the gdp associated with the SOP is unaffected and the geometry is placed in other_gdp.

    If the clean flag is set, the target gdp (either the other_gdp, or the gdp of the SOP) will be cleared before the copy is done.

  • duplicateChangedSource(int index, float t, int *changed_flag = 0)
    This method will duplicate the input geometry into the SOP's gdp. The duplication will only occur if the input has changed since the last time this function was called.

    This is useful if the SOP's cook method is just changing attributes of the incoming geometry - without adding or removing attributes. For example, the transform SOP simply moves point position of the input around. Thus, the transform doesn't really have to copy the input geometry every time it cooks, it can simply move the points of the duplicated source based on a transform of the input geometry.

    If the input geometry has changed, or there's an error, the changed_flag will be set to one, otherwise, it will be zero.

  • cookMyGuide1(OP_Context &)
    cookMyGuide2(OP_Context &)
    It is possible to add your own guide geometry to a SOP. You must tell the SOP that guide geometry is going to be used by setting the SOP flag in the SOP's constructor. i.e. mySopFlags.setNeedGuide1(1); to enable guide 1.

    The guide details are SOP_Guide objects which are derived off of a GU_Detail. They are named myGuide1 and myGuide2 respectively. The cookMyGuide methods are written in much the same way as the cook methods for SOPs with the added functionality that the SOP_Guide class provides.

    See cooking SOPs for more details.

  • parseGroups(const char *pattern, GU_Detail *which_gdp, GB_PrimitiveGroup *&prim, GB_PointGroup *&points)

    parsePrimitiveGroups(const char *pattern, GU_Detail *which_gdp=0, int allow_numeric=1)

    parsePointGroups(const char *pattern, GU_Detail *which_gdp=0, int allow_numeric=1)

    If groups are being used within the SOP then you will want to determine the actual geometry group that is defined within the group string field. The three methods above allow this. If there is more than one group specified the resulting group will be the union of the input groups. If you do not pass in a gdp then it is assumed that the SOP's gdp is used to search for groups.

    If the SOP is interested in receiving both primitive and point group information then parseGroups should be used. It will return both a point and primitive group based on the incoming pattern.

    If you are just interested in one type then parsePrimitiveGroups or parsePointGroups may be used. They return a pointer to a GB_PrimitiveGroup or a GB_PointGroup respectively. If nothing was found (nil) is returned.

    WARNING: In the process of creating these groups, extra groups are created. If you do not wish them to be passed along they may be destroyed by calling destroyPrimitiveGroup(group), or destroyPointGroup(group)

  • parseEachGroup(const char *pattern, GroupOperation operation, void *data, int isPrim, GU_Detail *which_gdp)
    This is similar to the three methods defined above. However, instead of returning the unioning of all the groups present as one group, this method will do an operation on a per group basis.

    parseEachGroup takes in the pattern, determines what the groups are and then iterates for each group calling the operation method. GroupOperation is a typedef of a member function that passes in the group and void *data pointer.

    typedef void (SOP_Node::*GroupOperation)(GB_Group *, void *);

    If isPrim is 1 then it parses only primitive groups. If isPrim is 0 then it parses only point groups.


  • Table of Contents
    Operators | Surface Operations | Particle Operations | Composite Operators | Channel Operators
    Material & Texture | Objects | Command and Expression | Render Output |
    Mantra Shaders | Utility Classes | Geometry Library | Image Library | Clip Library
    Customizing UI | Questions & Answers

    Copyright © 2004 Side Effects Software Inc.
    477 Richmond Street West, Toronto, Ontario, Canada M5V 3E7