Channel InfoAvailability LightWave 6.0 A channel is an animation parameter that varies as a function of time. In contrast to envelopes, which are arrays of keys, channels may include the effects of other plug-ins and calculations. The channel info global gives you access to Layout's list of grouped channels. A channel's underlying envelope data may also be read (see the Animation Envelopes page for more information). Global Call LWChannelInfo *chaninfo; chaninfo = global( LWCHANNELINFO_GLOBAL, GFUSE_TRANSIENT ); The global call returns a pointer to an LWChannelInfo. typedef struct st_LWChannelInfo {
LWChanGroupID (*nextGroup) (LWChanGroupID parent,
LWChanGroupID group);
LWChannelID (*nextChannel) (LWChanGroupID, LWChannelID);
const char * (*groupName) (LWChanGroupID);
const char * (*channelName) (LWChannelID);
LWChanGroupID (*groupParent) (LWChanGroupID);
LWChanGroupID (*channelParent) (LWChannelID);
int (*channelType) (LWChannelID);
double (*channelEvaluate) (LWChannelID, LWTime);
const LWEnvelopeID (*channelEnvelope) (LWChannelID);
int (*setChannelEvent) (LWChannelID,
LWChanEventFunc, void *);
const char * (*server) (LWChannelID, const char *class,
int index);
unsigned int (*serverFlags) (LWChannelID, const char *class,
int index );
LWInstance (*serverInstance) (LWChannelID, const char *class,
int index );
int (*serverApply) (LWChannelID, const char *class,
const char *name, int flags );
void (*serverRemove) (LWChannelID, const char *class,
const char *name, LWInstance);
} LWChannelInfo;
History In LightWave 7.0, the service name for this global was incremented from "Channel Info" to "Channel Info 2", and the serverFlags, serverInstance, serverApply and serverRemove functions were added, along with the LWCEVNT_VALUE event code. Example The find_channels function finds all of the channels belonging to a group and prints the name and type of each channel. It calls itself recursively to examine the subgroups of the parent group. #include <lwserver.h>
#include <lwenvel.h>
static void find_channels( LWChannelInfo *chinfo,
LWChanGroupID parent, int indent )
{
LWChanGroupID group;
LWChannelID chan;
group = chinfo->nextGroup( parent, NULL );
while ( group ) {
printf( "%*s(G) \"%s\"\n", indent, " ",
chinfo->groupName( group ));
find_channels( chinfo, group, indent + 2 );
chan = chinfo->nextChannel( group, NULL );
while ( chan ) {
printf( "%*s(C) \"%s\" type %d\n", indent + 2, " ",
chinfo->channelName( chan ),
chinfo->channelType( chan ));
chan = chinfo->nextChannel( group, chan );
}
group = chinfo->nextGroup( parent, group );
}
}
|