CommandSequence DisplacementHandler Classes Table of Contents

CustomObjHandler
CustomObjInterface

Availability:  LightWave 6.0
Component:  Layout

Custom objects provide a method for drawing in Layout's scene views. They can be the visual representation of abstract data in the scene, similar to the 3D cross Layout draws to represent the position and orientation of null objects.

Handler Activation Function

   XCALL_( int ) MyCustomObj( long version, GlobalFunc *global,
      LWCustomObjHandler *local, void *serverData );

The local argument to a custom object's activation function is an LWCustomObjHandler.

   typedef struct st_LWCustomObjHandler {
      LWInstanceFuncs *inst;
      LWItemFuncs     *item;
      LWRenderFuncs   *rend;
      void            (*evaluate) (LWInstance, const LWCustomObjAccess *);
      unsigned int    (*flags)    (LWInstance);
   } LWCustomObjHandler;

The first three members of this structure are the standard handler functions. In addition to these, a custom object provides an evaluation function and a flags function.

evaluate( instance, access )
Draw the object on the interface using the information in the access structure, described below.

flags( instance )
Returns boolean settings for the object. None are currently defined.

Interface Activation Function

   XCALL_( int ) MyInterface( long version, GlobalFunc *global,
      ??? *???, void *serverData );

TBD

Custom Object Access

The access structure contains drawing functions and fields indicating which of the interface views the object will be drawn in and whether it is currently selected.

Except as noted, there aren't any restrictions on what your custom object looks like. But it will be helpful to users if your object's appearance is consistent with the rest of Layout's interface. You'll automatically get the user's choice of color

   typedef struct st_LWCustomObjAccess {
      int   view;
      int   flags;
      void *dispData;
      void (*setColor)   (void *, float rgb[3]);
      void (*setPattern) (void *, int lpat);
      void (*point)      (void *, double[3], int csys);
      void (*line)       (void *, double[3], double[3], int csys);
      void (*triangle)   (void *, double[3], double[3], double[3],
                            int csys);
      void (*circle)     (void *, double[3], double, int csys);
   } LWCustomObjAccess;
view
The view the object will be drawn in. Possible values are

LWVIEW_ZY
LWVIEW_XZ
LWVIEW_XY
LWVIEW_PERSP
LWVIEW_LIGHT
LWVIEW_CAMERA

These refer to the orthographic, perspective, light and camera views available to the user in the Layout interface.

flags
Contains bitfields with information about the context of the render request. Currently the only flag defined is LWCOFL_SELECTED, which tells you whether the object should be rendered in its selected state.

dispData
An opaque pointer to private data used by Layout. Pass this as the first argument to the drawing functions.

setColor( dispData, rgb )
Set the current drawing color. Calling this is optional. By default, all drawing is done in the color set by the user in the Scene panel when the custom object isn't selected, and in yellow when the object is selected. Color settings don't persist between calls to the evaluation function, nor do they change the settings in the Scene panel.

setPattern( dispData, linepat )
Set the current line pattern. The pattern codes are

LWLPAT_SOLID
LWLPAT_DOT
LWLPAT_DASH
LWLPAT_LONGDOT

As with setColor, calling setPattern is optional. By default, all drawing is done with solid lines. Line pattern settings don't persist between evaluations.

point( dispData, xyz, coord_sys )
Draw a point at the specified position. The point will be drawn in the color set by the most recent setColor call, or in the default color if no color was set. The coordinate system argument identifies the coordinates in which the position is expressed and may be one of the following.

LWCSYS_WORLD
LWCSYS_OBJECT
LWCSYS_ICON

LWCSYS_ICON is a special coordinate system that works like LWCSYS_OBJECT but scales with the grid size. Layout's camera and light images are examples of the use of this mode.

line( dispData, end1, end2, coord_sys )
Draw a line between the specified endpoints using the current color and line pattern.

triangle( dispData, v1, v2, v3, coord_sys )
Draw a triangle with the specified vertices using the current color and line pattern.

circle( dispData, center, radius, coord_sys )
Draw a circle of the given radius around the specified center point using the current color and line pattern. Circles can only be drawn in the orthographic views, not in the light, camera or perspective views.