Implementation

A custom Fx operator is written as a set of pre-defined user functions which define the setup and rendering of an effect. These fall into three main areas:

• Process Definition and Initialization

- Process identification

- Input, output and parameter definition

- Process and parameter initialization

• Process Rendering

- Pre- and post-rendering

- Defined output and required input region calculation

- Rendering

• External User Interface

- Editor screen drawing

- Editor screen interaction

These user functions communicate with the main body of code via an interface library of support functions. The UFO code is compiled and linked into a Dynamic Shared Object (.so) or Dynamically Linked Library (.dll) which is loaded into Softimage at run-time.

The symbols for the pre-defined functions are searched for in the custom Fx operator and their addresses are tabulated for future calling. The final appearance when the operator is run is as if the functions were directly linked into the product.

The interface library is written with C binding for which the following header files are supplied:

ufoProcess.h: Process interface and general interface. Contains Functions the host provides to the plug-ins to get and set plug-in properties, to be called during plug-in definition and during rendering.

ufoRaster.h: Raster access interface, pixel structures, and constants.

ufoTypes.h: General interface constant definitions.

ufoEditor.h: Editor interface. Contains functions the host provides to help implement OpenGL interactive tools.

ufoFunctions.h: The complete set of user functions is declared in the header file. This should be included in the UFO source code files to enforce the correct function prototypes of the functions the UFO plug-in can implement.

ufoUnixCompat.h: Defines rint(), drand48, random, and M_PI for easy portability of plug-ins between Linux and Windows. random is garanteed to have good distribution and provide same results on both platforms, and should be used under Windows instead of the compiler-provided random number generator.

The user functions are:

Function

Description

ufoProcessDefine

process definition and initialization

ufoProcessCopyUserData

user data copy

ufoProcessDeleteUserData

user data delete

ufoProcessPreSequenceRender

pre-render sequence

ufoProcessPostSequenceRender

post-render sequence

ufoProcessCanAvoidRendering

pre-frame render function to determine if rendering can be avoided

ufoProcessPreRender

pre-render

ufoProcessPostRender

post-render

ufoProcessPreRenderPass

pre-render pass

ufoProcessPostRenderPass

post-render pass

ufoProcessRenderPixel

pixel render

ufoProcessRenderLine

line render

ufoProcessRenderRectangle

rectangle render

ufoProcessCalcDefinedRectangle

calculate rectangle which can be rendered to output(s)

ufoProcessCalcNeedRectangles

calculate rectangles which are required from inputs

ufoProcessCalcDefinedPixelType

calculate the “best” pixel type given the supplied input pixel types

ufoProcessSpecifyConvertPixelTypes

specify input and output pixel type conversions

ufoProcessParamsEdited

callback routine on parameter edits; can also set other parameters to be changed too

ufoEditorBeginViewerEditing

Called when a process is being edited in a viewer, redraw and mouse callbacks can be expected to be called.

UfoEditorEndViewerEditing

Called when a process is no longer being edited in a viewer.

ufoEditorRGBDraw

draw into RGB plane of screen

ufoEditorOverlayDraw

draw into overlay plane of screen

ufoEditorMouseDown

process mouse button down event onscreen

ufoEditorMouseUp

process mouse button up event onscreen

ufoEditorMouseDrag

process mouse drag onscreen

ufoEditorMousePosition

process mouse move (no buttons down) event onscreen

ufoEditorKeyEvent

process key event onscreen

ufoEditorSetParamGroup

set/change parameter group to be drawn or displayed in GUI

The minimum requirement is that an operator defines ufoProcessDefine, and one of the following: ufoProcessRenderPixel, ufoProcessRenderLine and ufoProcessRender-Rectangle. If this requirement is not met, then the operator process cannot be used and will not appear in Fx tree.

The minimum requirement for screen interaction is that an operator defines ufoEditorCreate, and one of the following: ufoEditorRGBDraw, ufoEditorOverlayDraw, ufoEditorMouseDown, ufoEditorMouseUp, ufoEditorMouseDrag, ufoEditorMousePosition, and ufoEditorKeyEvent.

The minimum requirement for a user-defined X Motif GUI is that anoperator defines both ufoEditorCreate and ufoEditorUpdateGui.



Autodesk Softimage v7.5