Bone Info
Availability LightWave 6.0 | Component Layout | Header lwrender.h
The bone info global returns functions for getting bone-specific information about any of the bones in a scene. Use the item info global to get the bone list and for generic item information. The data returned by these functions is read-only, but you can use commands to set many of the parameters.
Global Call
LWBoneInfo *boneinfo; boneinfo = global( LWBONEINFO_GLOBAL, GFUSE_TRANSIENT );
The global function returns a pointer to an LWBoneInfo.
typedef struct st_LWBoneInfo { unsigned int (*flags) (LWItemID); void (*restParam) (LWItemID, LWItemParam, LWDVector vec); double (*restLength)(LWItemID); void (*limits) (LWItemID, double *inner, double *outer); const char * (*weightMap) (LWItemID); double (*strength) (LWItemID); int (*falloff) (LWItemID); void (*jointComp) (LWItemID, double *self, double *parent); void (*muscleFlex)(LWItemID, double *self, double *parent); } LWBoneInfo;
boneflags = flags( bone )
- Returns a set of flag bits combined using bitwise-or. The flags are
LWBONEF_ACTIVE
- The bone is active.
LWBONEF_LIMITED_RANGE
- The bone has a limited range.
LWBONEF_SCALE_STRENGTH
- The strength of the bone is scaled by the rest length.
LWBONEF_WEIGHT_MAP_ONLY
- Deformation will be based solely on the weight map.
LWBONEF_WEIGHT_NORM
- The weight normalization option is turned on. The relative strength of each weight map value is scaled so that the total for all values is 1.0.
LWBONEF_JOINT_COMP
LWBONEF_JOINT_COMP_PAR- Joint compensation is enabled for the bone. This can also account for the rotation of the bone's parent.
LWBONEF_MUSCLE_FLEX
LWBONEF_MUSCLE_FLEX_PAR- Muscle flexing is enabled for the bone. Like joint compensation, this is a volume preserving adjustment to the deformation caused by the bone and can include the effect of the bone's parent.
restParam( bone, param_type, vector )
- Gets vector parameters for the rest position of a given bone. Parameters of the animated
bone can be read from the normal item info functions. See the
item info parameter list for the values that can be
passed in the
param_type
argument. length = restLength( bone )
- Returns the rest length of the bone.
limits( bone, inner_limit, outer_limit )
- For limited range bones, this gets the inner and outer limit radii for the bone.
name = weightMap( bone )
- Returns the name of the weight map for the bone. The weight map is a vertex map of type
LWVMAP_WGHT
. The object info and scene objects globals provide functions for reading the values in a vmap. bone_strength = strength( bone )
- Returns the bone strength setting.
type = falloff( bone )
- Returns the falloff as an index into an options list. In general, the falloff function
is the distance raised to the power -2
type
. Atype
of 0 is inverse distance, 1 is inverse distance squared, 2 is inverse distance to the fourth power, and so on. jointComp( bone, self, parent )
- Fills in
self
andparent
with the joint compensation amount. muscleFlex( bone, self, parent )
- Fills in
self
andparent
with the muscle flexing amount.
History
In LightWave 7.0, the server name for this global (LWBONEINFO_GLOBAL
) was
incremented from "LW Bone Info 2" to "LW Bone Info 3". The following
functions and flags were added.
strength falloff jointComp muscleFlex LWBONEF_JOINT_COMP LWBONEF_JOINT_COMP_PAR LWBONEF_MUSCLE_FLEX LWBONEF_MUSCLE_FLEX_PAR
Example
This code fragment collects information about the bones in the scene.
#include <lwserver.h> #include <lwrender.h> LWItemInfo *iteminfo; LWBoneInfo *boneinfo; LWItemID object, bone; unsigned int flags; LWDVector pos; double restlen; iteminfo = global( LWITEMINFO_GLOBAL, GFUSE_TRANSIENT ); boneinfo = global( LWBONEINFO_GLOBAL, GFUSE_TRANSIENT ); if ( !iteminfo || !boneinfo ) return AFUNC_BADGLOBAL; object = iteminfo->first( LWI_OBJECT, NULL ); while ( object ) { bone = iteminfo->first( LWI_BONE, object ); while ( bone ) { flags = boneinfo->flags( bone ); boneinfo->restParam( bone, LWIP_POSITION, pos ); restlen = boneinfo->restLength( bone ); ... bone = iteminfo->next( bone ); } object = iteminfo->next( object ); }