[SESI logo]

Prisms Development Toolkit Documentation

Side Effects Software Inc. 1997

Custom SOP Reference

The SOP_DATA and sopParms structures

These structures together define what the SOP looks like in action, along with what kind of data it expects from the animator.

The SOP_DATA structure contains, unsurprisingly, the data associated with your SOP. The first elements in it are the values the animator will input into the SOP when running the custom action you will create.

In our Circle SOP, the first entry is a 3-valued entry line, corresponding to the XYZ center of the circle. Then it has a single value, for the radius. Next is a rollover menu, where the animator chooses which plane to draw the circle in. Then there is another single value field.

To indicate this information to custom, the SOP_DATA structure could look like this:


typedef struct sop_data 
{
    SOP_EXPR        center[3];	/* collect 3 values on one line */
    SOP_EXPR        radius;	/* collect a single value */
    SOP_EXPR        orient;	/* this will be a menu choice */
    SOP_EXPR        ndivs;

    /*
     * You can stick any private data you want after the declaration
     * of the SOP_EXPR fields.  Here, we keep track of the number of
     * times the SOP has been cooked (for the $COOK local variable)
     */
    int		cookCount;
} SOP_DATA;

Notice that every SOP variable is declared to be type SOP_EXPR. This is a Prisms-defined structure which corresponds to a fields in a sop. It can hold an int, a float, a character or a pointer to a function, and it has an associated label and menu.

So how does custom know that 'orient' is a menu choice while 'radius' is a floating point number? From the data in the sopParms structure.

Each entry in the sopParms table must correspond exactly to an entry in the SOP_DATA structure:


static SOP_PARMS        sopParms[] = {
	{ SOPPARM_TRIPLE,       "center", 	NULL , { NULL } },
	{ SOPPARM_TRIPLE,       "(ignored)", 	NULL , { NULL } },
	{ SOPPARM_TRIPLE,       "(ignored)", 	NULL , { NULL } },
	{ SOPPARM_EXPR,         "radius", 	NULL , { NULL } },
	{ SOPPARM_MENU,         "orientation", 	NULL , { NULL } },
        { SOPPARM_EXPR,         "divisions", 	NULL , { NULL } },
        { NULL },
};
The first entry on each line is the type of parameter. This is a Prisms- defined constant. Possible types are
SOPPARM_EXPR		A compilable expression (eg, 1.23, $F, sin($T))
SOPPARM_DOUBLE		Two exprs on a line
SOPPARM_TRIPLE		Three exprs on a line
SOPPARM_TOGGLE		Toggle on or off
SOPPARM_MENU		Pulls up a menu
SOPPARM_STR		A single string
SOPPARM_FUNC		Calls a function
SOPPARM_FILE		File name (has a file prompter)
SOPPARM_OBJECT		An object name (has a menu of names)
SOPPARM_USERMENU        Any expression (has menu)
SOPPARM_DOUBLE_TIED	EXPR Two tied exprs on a line
SOPPARM_TRIPLE_TIED	EXPR Three tied exprs on a line
SOPPARM_STRDOUBLE	2 Strings
SOPPARM_PATTERN		Get a poly or point pattern
SOPPARM_PATDOUBLE	Get two poly or point patterns
The second entry is the string that will appear on the SOP next to the data entry space. The maximum size of this label is 15 characters. The third entry is always NULL for user SOPs. The fourth entry is an index into the help table, for balloon help. For user SOPs, it should always be NULL. Notice that the structure is finished with a NULL entry.
Tookit Overview
Expression Functions | User Functions | Custom SOPs
Prisms Internal Format | Programmer's Reference
Compiling SOPs | Using sopbuild | SOP Routine Reference
Dynamic SOPs | Prisms Types | Macros
Math Routines | Data Routines | Polygon Routines | Winged-edge Routines

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