Custom Objects

Like Item Animation, Custom Object can take an optional argument to its create() UDF that is an Object Agent for the object to which this script is assigned. Custom Object also supports the init(), newtime() and cleanup() UDFs.

The Custom Object process() UDF takes a single argument which is a Custom Object Agent that provides an interface to the underlying Custom Object functionality. It exports the following data and methods:

The Custom Object create() UDF can also take an optional argument which provides an interface to the object which the script is applied to, as below

@version 2.4
@script custom
@name objectID


create: obj
    myobjid =;
    setdesc("internal lscript id: " + myobjid + " scene id:" + strsub(hex(myobjid),3,size(hex(myobjid))));

Data Members

a read-only data member that indicates which view drawing will effect. It will contain one of the following:


Read-only array of settings for the current Custom instance. it only has a single element right now (flags[1]) which will be 'true' if the Custom object should be drawn in a selected state, or 'false' otherwise.
In addition to SCHEMA, the Custom Object flags() function can now also return the following values:

indicates that the value in the view data member should correspond to the viewport number instead of its type.

causes drawing of the object to occur in front of all other OpenGL elements, regardless of Z position.


Sets the color for subsequent drawing actions.

Sets the drawing pattern. Solid by default, or can be one of the following:

    PATTERN_DOT (or "DOT")

Draw a point into the current view at the vector location <pos> using the previously set color and line pattern. The coord parameter is optional (SYS_OBJECT is the default), and can be one of the following:

    SYS_WORLD (or "WORLD" or "GLOBAL")
    SYS_ICON (or "ICON")

Draws a line segment from vector <pos1> to vector <pos2>.

draws a triangle whose end points are vector <pos1>, vector <pos2>, and vector <pos3>.

draws a circle whose center point is vector <pos>, with a radius of rad.

draws the provided text string at the vector location <pos>. the align argument can be one of the following:

    LEFT (or "LEFT")
    CENTER (or "CENTER")
    RIGHT (or "RIGHT")

The plug-in API does not maintain state information between evaluations, and neither does LScript. This means that every time the process() UDF is called, the color is set back to that established for the object in the Layout interface, and the drawing pattern is always PATTERN_SOLID.

Here is a short Custom Object LScript that duplicates the "barn" sample provided by Ernie in the LightWave SDK:

  @script custom

  vert = @ <0.0, 0.0, 0.0>, <1.0, 0.0, 0.0>, <1.0, 1.0, 0.0>,
     <0.5, 1.5, 0.0>, <0.0, 1.0, 0.0>, <0.0, 0.0, -1.0>,
     <1.0, 0.0, -1.0>, <1.0, 1.0, -1.0>, <0.5, 1.5, -1.0>,
     <0.0, 1.0, -1.0> @;

  edge = @ 1, 2, 2, 3, 3, 4, 4, 5, 5, 1, 6, 7,
     7, 8, 8, 9, 9, 10, 10, 6, 1, 6, 2, 7,
     3, 8, 4, 9, 5, 10, 2, 5, 1, 3 @;

   process: ca
      for(x = 1;x < 31;x += 2)
      for(x = 31; x < 35;x += 2)