Node Editor Func Panels Globals Table of Contents

Object Info

Availability  LightWave® 6.0
Component  Layout
Header  lwrender.h

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. See also the Scene Objects global. The data returned by the object info functions is read-only, but you can use commands to set many of the parameters.

Global Call

   LWObjectInfo *objinfo;
   objinfo = global( LWOBJECTINFO_GLOBAL, 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);
      LWMeshInfoID (*meshInfo)    (LWItemID, int frozen);
      unsigned int (*flags)       (LWItemID);
      double       (*fog)         (LWItemID, LWTime);
      LWTextureID  (*dispMap)     (LWItemID);
      LWTextureID  (*clipMap)     (LWItemID);
      void         (*patchLevel)  (LWItemID, int *display, int *render);
      void         (*metaballRes) (LWItemID, double *display,
                                     double *render);
      LWItemID     (*boneSource)  (LWItemID);
      LWItemID     (*morphTarget) (LWItemID);
      double       (*morphAmount) (LWItemID, LWTime);
      unsigned int (*edgeOpts)    (LWItemID);
      void         (*edgeColor)   (LWItemID, LWTime, LWDVector color);
      int          (*subdivOrder) (LWItemID);
      double       (*polygonSize) (LWItemID, LWTime);
      int          (*excluded)    (LWItemID object, LWItemID light);
      void         (*matteColor)  (LWItemID, LWTime, LWDVector color);
      double       (*thickness)   (LWItemID, LWTime, int type);
      double       (*edgeZScale)  (LWItemID, LWTime);
      double       (*shrinkEdgesNominalDistance)  (LWItemID objectitem, LWTime time);
      double       (*maxDissolveDistance)  (LWItemID objectitem);
      double       (*bumpDistance)  (LWItemID objectitem);
      unsigned int (*getGroupIndex) (LWItemID);
      int          (*dispMapOrder)  (LWItemID);
      int          (*bumpOrder)     (LWItemID);
   } 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. 
sopts = 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.
meshinfo = meshInfo( object, frozen )
Returns a mesh info structure for the object. This is a complete description of the object's geometry. See the Mesh Info page for a detailed discussion of mesh info structures. 
If frozen is true, the mesh for objects with subpatches and metaballs will contain the geometry that results from subdivision and isosurface calculation. The pntBasePos function will return the same point positions that Layout uses for object coordinate texture mapping. These are completely undeformed positions in the case of regular polygons and subpatches, and positions at freezing time for metaballs and partigons. pntOtherPos will return the actual world coordinates used by Layout. These should only be considered final if the mesh is obtained after all object transformations have been completed.
f = flags( object )
Returns the state of certain object settings as bits combined using bitwise-or. Possible flags are 
LWOBJF_UNSEEN_BY_CAMERA
LWOBJF_UNSEEN_BY_RAYS
LWOBJF_UNAFFECT_BY_FOG
LWOBJF_MORPH_MTSE
LWOBJF_MORPH_SURFACES (LW7.5+)
LWOBJF_MATTE (LW7.5+)
LWOBJF_UNSEEN_BY_ALPHA (LW7.5+)
This is set when object alpha is set to 'Unaffected By Object'
LWOBJF_ALPHA_CONSTANT_BLACK (rev.6+)
This is set when object alpha is set to 'Constant Black'
LWOBJF_DISTANCEDISSOLVE (rev.6+)
This flag indicates that distance dissolve is enabled for the object.
LWOBJF_BUMPENABLE (rev.6+)
This flag indicates that bump displacement is enabled for the object.
LWOBJF_FASTERBONES (rev.6+)
This flag indicates the 'faster bones' feature is enabled for the object.
LWOBJF_USEMORPHEDPOSITIONS (rev.6+)
This flag indicates the 'use morphed positions' object option is enabled.
LWOBJF_CONTAINS1POINTPOLYGONS (rev.6+)
This flag indicates that the object contain one or more one-point polygons (polygons having only one vertex).
LWOBJF_CONTAINSPATCHES (rev.6+)
This flag indicates that the object contains one or more sub-patch polygons.
LWOBJF_CONTAINSMETABALLS (rev.6+)
This flag indicates that the object contains one or more meta-ball polygons.
LWOBJF_CONTAINSPARTIGONS (rev.6+)
This flag indicates that the object contains one or more partigon polygons.
LWOBJF_CONTAINSCUSTOMPOLYGONS (rev.6+)
This flag indicates that the object contains one or more custom (not internally defined) polygons.
LWOBJF_NODEDISPENABLED (rev.7+)
This flag indicates that nodal displacement is enabled for the object.
LWOBJF_NODEFORMERSAPPLIED (rev.7+)
This flag indicates that no deformation of the mesh took place, only rigid body transformations (scale/translate/rotate)
foglevel = fog( object, time )
Returns the amount by which the object is affected by fog.
texture = dispMap( object )
Returns the texture ID of the displacement image map applied to the object.
texture = clipMap( object )
Returns the texture ID of the clip map applied to the object.
patchLevel( object, display, render )
Returns the interface and render patch level for the object's subpatches.
metaballRes( object, display, render )
Returns the interface and render resolution of the object's metaballs.
boneobj = boneSource( object )
Returns the object whose bones are being used to deform the given object. (An object can be deformed by the bones of another object.)
morphobj = morphTarget( object )
Returns the morph target of the given object.
amount = morphAmount( object, time )
Returns the morph amount at a given time. If flags returns the LWOBJF_MORPH_MTSE bit, Multiple Target/Single Envelope morphing is enabled, and the morph amount includes an index into a chain of morph targets. Assume A's target is B, and B's target is C. Morph amounts between 0.0 and 1.0 morph A to B, while amounts between 1.0 and 2.0 morph A to C. The interpolant is the fractional part of the morph amount, and the index is the integer part.
options = edgeOpts( object )
Returns the object's edge rendering options, which can be any of the following combined using bitwise-or.
LWEDGEF_SILHOUETTE
LWEDGEF_UNSHARED
LWEDGEF_CREASE
LWEDGEF_SURFACE
LWEDGEF_OTHER
Edge lines are drawn in the indicated areas. An unshared edge belongs to only one polygon. A crease is an edge where two polygons meet at an angle exceeding the max smoothing angle of the surface. A surface edge is where the polygons on either side have different surfaces.
LWEDGEF_SHRINK_DIST
The thickness of the lines is proportional to distance from the camera.
edgeColor( object, time, color )
The color used to render edges is written in the color argument.
index = subdivOrder( object )
Returns the subdivision order as a 0-based index into a list of options.

0 - First
1 - After Morphing
2 - After Bones
3 - After Displacement
4 - After Motion
5 - Last
size = polygonSize( object, time )
Returns the polygon size setting. This is a scale factor with a default of 1.0.
state = excluded( object, light )
Returns true if the light is excluded from the object. Light exclusion is a user setting that prevents the light from affecting the rendering of the object.
matteColor(object,  time,  color) (LW7.5+)
The matte color set for the object is writen into the color argument.
thick = thickness(object,  time,  type) (LW7.5+)
Returns the thickness for the specified edge type, where type is one of the following:
LWTHICK_SILHOUETTE
LWTHICK_UNSHARED
LWTHICK_CREASE
LWTHICK_SURFACE
LWTHICK_OTHER
LWTHICK_LINE
LWTHICK_PARTICLE_HEAD
LWTHICK_PARTICLE_TAIL
zsc = edgeZScale( object,  time ) (LW7.5+)
Returns the Edge Z Scale setting for edge rendering of object.
send = shrinkEdgesNominalDistance( objectitem, time ) (rev.5+)
This obtains nominal distance value when shrink edges is enabled.
mdd = maxDissolveDistance( objectitem ) (rev.6+)
This obtains the maximum dissolve distance for use when distance dissolve is enabled.
bd = bumpDistance( objectitem ) (rev.6+)
This obtains the bump distance when bump displacement is enabled.
order = dispMapOrder( objectitem ) (rev.7+)
Returns the displacement order of the displacement map as a displacement plugin LWDMF_* flag.
order = bumpOrder( objectitem ) (rev.7+)
Returns the displacement order of the bump displacement as a displacement plugin LWDMF_* flag.

Example

The scenscan and unwrap SDK samples use the ObjectInfo global.

The following code fragment collects information about the first object.

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

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

   iteminfo = global( LWITEMINFO_GLOBAL, GFUSE_TRANSIENT );
   objinfo  = global( LWOBJECTINFO_GLOBAL, GFUSE_TRANSIENT );

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