|
Prisms Development Toolkit Documentation
Side Effects Software Inc. 1997
|
Custom SOPs
Naming and Defining the SOP
Of course, you can name your SOP whatever you want, up to 10 characters.
But this section shows where to put that name string so that the SOP
appears in the menu and can be found by action.
Source Listing:
#include <custom.h> /* you must have this! */
/*
* other sop definition routines
*/
.
.
.
/*
* This is the usage string that will be used by the action help command
* It is very important the the first word of the usage is the made of
* 's' + sop_name - i.e. severything
* Otherwise Action will core dump if the SOP is saved or loaded
*/
#define SOPUSAGE \
"severything -S String -F File -e Single \
-d double1 double2 -t triple1 triple2 \
triple 3 -T -m menuItem -o Object -u UserMenu\n\
\t-s Just a string\
\tetc\n"
SOP_FUNC EverythingSopRef = {
"everything", /* name in SOPs menu */
"S:F:e:d::t:::Tm:u:",
sopScan,
sopPrint,
sopCook,
sopDefaults,
sopClean,
sopGPMake,
sopGetParms,
SOPUSAGE,
};
In order for action to know about your sop, you must include it in
the user SOP reference table. This is done through another C file, usually
called usersop.c. It needs to be changed as follows:
#include <custom.h>
extern SOP_FUNC EverythingSopRef;
/* Now define the table for Action to know about the SOPs */
SOP_FUNC *UserSopTable[] = {
&EverythingSopRef,
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 EverythingSopRef appears in two places.
Notice also
that it must be the same string used in naming the
SOP_FUNC structure. You can have more
than one custom SOP in action. In our example, to have another
SOP, called "AndMore", available to the animator, the file usersop.c
would look like:
#include <custom.h>
extern SOP_FUNC EverythingSopRef;
extern SOP_FUNC AndMoreSopRef;
SOP_FUNC *UserSopTable[] = {
&EverythingSopRef,
&AndMoreSopRef,
0,
};
void
sbprompt(void)
{
}
For More Detailed Information:
The SOPUSAGE macro
The SOP_FUNC reference structure
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