Info Messages Product Info Globals Table of Contents

"LW Object Info"

Availability:  LightWave 6.0
Component:  Layout

The object info global returns functions for getting object-specific information about any of the objects in a scene. Use the item info global to get the object list and for generic item information. For complete information about the geometry in the object files used in a scene, you can use the scene objects global.

The information returned by the object info functions is read-only.

Global Call

   LWObjectInfo *objinfo;
   objinfo = global( "LW Object Info", GFUSE_TRANSIENT );

The global function returns a pointer to an LWObjectInfo.

   typedef struct st_LWObjectInfo {
      const char * (*filename)    (LWItemID);
      int          (*numPoints)   (LWItemID);
      int          (*numPolygons) (LWItemID);
      unsigned int (*shadowOpts)  (LWItemID);
      double       (*dissolve)    (LWItemID, LWTime);
   } LWObjectInfo;
name = filename( object )
Returns the filename for the object file.

count = numPoints( object )
Returns the number of points in the object mesh.

count = numPolygons( object )
Returns the number of polygons in the object mesh.

options = shadowOpts( object )
Returns bits for shadow options.

LWOSHAD_SELF
LWOSHAD_CAST
LWOSHAD_RECEIVE

amount = dissolve( object, time )
Returns the object dissolve amount at the given time.
 

Example

This code fragment collects information about the first object.

   #include <lwserver.h>
   #include <lwrender.h>

   LWItemInfo *iteminfo;
   LWCameraInfo *objinfo;
   LWItemID id;
   LWTime t = 3.0;          /* seconds */
   char *fname;
   int npoints, npols;
   unsigned int shopts;
   double dissolve;

   iteminfo = global( "LW Item Info 2", GFUSE_TRANSIENT );
   objinfo  = global( "LW Object Info", GFUSE_TRANSIENT );

   if ( iteminfo && objinfo ) {
      id = iteminfo->first( LWI_OBJECT, NULL );
      fname    = objinfo->filename( id );
      npoints  = objinfo->numPoints( id );
      npols    = objinfo->numPolygons( id );
      shopts   = objinfo->shadowOpts( id );
      dissolve = objinfo->dissolve( id, t );
   }