[SESI logo]

Prisms Development Toolkit Documentation

Side Effects Software Inc. 1997

Custom SOPs

Compiling a Custom SOP

Compiling of your SOP is done using the custom command. The syntax for this command is:
custom [-n] sourcefile [more source files] -o output
The -n option compiles a non-graphical version of action, normally called acting.

Typically, you will create custom versions of action in a separate directory. The most common way to do this is to copy the files

usersop.c sample.c
from the directory
/ufs/prisms/support/action_custom/SOPs

and then modify sample.c to do what you want. Usersop.c also needs to be changed to add your new sop to the sop table. Many people use a Make file to compile everything.

A Complete Example

Let's say that you want to add a SOP called wowee to action. In the directory you are working in, you would have 3 files.

The first, wowee.c, would contain the source for your sop. What that looks like is explained in the next section.

The second, usersop.c, is important because it tells action to add your SOP to a table of user SOP references. It would look like this:


#include <custom.h>
extern SOP_FUNC         WoweeSopRef;

    /* Now define the table for Action to know about the SOPs */
SOP_FUNC    *UserSopTable[] = {
	    &WoweeSopRef,
	    0,			/* must be last entry in the table */
};

    /* This is a dummy function which may be needed for linking */
void
sbprompt(void)
{
}

Notice that the string "Wowee" appears in two places. You can have more than one custom SOP in action. In our example, to have another SOP, called "Kazowee", available to the animator, the file usersop.c would look like:

#include <custom.h>
extern SOP_FUNC         WoweeSopRef;
extern SOP_FUNC         KazoweeSopRef;
SOP_FUNC	*UserSopTable[] = {
		&WoweeSopRef,
		&KazoweeSopRef,
		0,
};

void
sbprompt(void)
{
}

The third file in this directory would be a Makefile. This is a file, called "Makefile", which is used by the UNIX make command to perform commands based on certain conditions.
This is optional, but it saves typing and simplifies things if you want both a graphical and non-graphical version of your custom action. The simplest possible Makefile could contain just the following lines:


newaction:	wowee.c usersop.c 
	custom usersop.c wowee.c  -o newaction

newacting:	wowee.c usersop.c 
	custom -n usersop.c wowee.c  -o newaction

This would be used by simply typing "make" or "make newaction" to get the graphical custom action, or "make newacting" to get the non-graphical one.
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