本文整理汇总了C++中CAnimation::getTrackNames方法的典型用法代码示例。如果您正苦于以下问题:C++ CAnimation::getTrackNames方法的具体用法?C++ CAnimation::getTrackNames怎么用?C++ CAnimation::getTrackNames使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAnimation
的用法示例。
在下文中一共展示了CAnimation::getTrackNames方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: refresh
void CAnimationSetDlg::refresh (BOOL update)
{
if (update)
{
CDialog::UpdateData (update);
// Clear the combo box
EditedObject.ResetContent ();
// Set edited object list
uint i;
for (i=0; i<_ObjView->getNumInstance (); i++)
{
char name[512];
_splitpath (_ObjView->getInstance (i)->Saved.ShapeFilename.c_str(), NULL, NULL, name, NULL);
EditedObject.InsertString (-1, name);
}
// Get edited object
uint instance = _ObjView->getEditedObject ();
// Selection combo box
EditedObject.SetCurSel ((instance==0xffffffff)?-1:(int)instance);
// Clear the tree
Tree.DeleteAllItems ();
// Clear the tree
SkelTree.DeleteAllItems ();
// Clear the playlist
PlayList.ResetContent ();
if (instance != 0xffffffff)
{
// Get the instance
CInstanceInfo *object = _ObjView->getInstance (instance);
// For all tracks in the animation
uint i;
for (i=0; i<object->Saved.AnimationFileName.size(); i++)
{
// Get the animation name
char name[512];
_splitpath (object->Saved.AnimationFileName[i].c_str(), NULL, NULL, name, NULL);
// Get the animation pointer
CAnimation *anim = object->AnimationSet.getAnimation (object->AnimationSet.getAnimationIdByName (name));
// Insert an intem
HTREEITEM item=Tree.InsertItem (name);
Tree.SetItemData (item, i);
nlassert (item!=NULL);
// For all tracks in the animation
std::set<std::string> setString;
anim->getTrackNames (setString);
std::set<std::string>::iterator ite=setString.begin();
while (ite!=setString.end())
{
// Add this string
HTREEITEM newItem = Tree.InsertItem (ite->c_str(), item);
Tree.SetItemData (newItem, 0xffffffff);
// Get the track
ITrack *track=anim->getTrack (anim->getIdTrackByName (*ite));
// Keyframer ?
UTrackKeyframer *keyTrack=dynamic_cast<UTrackKeyframer *>(track);
if (keyTrack)
{
// Get number of keys
std::vector<TAnimationTime> keys;
keyTrack->getKeysInRange (track->getBeginTime ()-1, track->getEndTime ()+1, keys);
// Print track info
char name[512];
_snprintf (name, 512, "%s (%f - %f) %d keys", typeid(*track).name(), track->getBeginTime (), track->getEndTime (), keys.size());
HTREEITEM keyItem = Tree.InsertItem (name, newItem);
Tree.SetItemData (keyItem, 0xffffffff);
}
else
{
// Print track info
char name[512];
_snprintf (name, 512, "%s (%f - %f)", typeid(*track).name(), track->getBeginTime (), track->getEndTime ());
HTREEITEM keyItem = Tree.InsertItem (name, newItem);
Tree.SetItemData (keyItem, 0xffffffff);
}
ite++;
}
}
// For all tracks in the animation
for (i=0; i<object->Saved.SWTFileName.size(); i++)
{
// Get the animation name
char name[512];
_splitpath (object->Saved.SWTFileName[i].c_str(), NULL, NULL, name, NULL);
//.........这里部分代码省略.........
示例2: setAutomaticAnimationSet
// ***************************************************************************
void CScene::setAutomaticAnimationSet(CAnimationSet *as)
{
// Backup the animation set
_AutomaticAnimationSet = as;
// Delete all auto lightmap animations
_LMAnimsAuto.deleteAll();
_AnimatedLightNameToIndex.clear();
_AnimatedLight.clear();
_AnimatedLightPtr.clear();
_LightGroupColor.clear();
// Register each animation as lightmap
const uint count = _AutomaticAnimationSet->getNumAnimation();
uint i;
for (i=0; i<count; i++)
{
// Pointer on the animation
CAnimation *pAnim = _AutomaticAnimationSet->getAnimation(i);
/* uint nAnimNb;
// Reset the automatic animation if no animation wanted
if( pAnim == NULL )
{
_AnimatedLight.clear();
_AnimatedLightPtr.clear();
_AnimatedLightNameToIndex.clear();
nAnimNb = _LightmapAnimations.getAnimationIdByName("Automatic");
if( nAnimNb != CAnimationSet::NotFound )
{
CAnimation *anim = _LightmapAnimations.getAnimation( nAnimNb );
delete anim;
}
_LightmapAnimations.reset();
_LMAnimsAuto.deleteAll();
return;
}
*/
set<string> setTrackNames;
pAnim->getTrackNames( setTrackNames );
// nAnimNb = _LightmapAnimations.addAnimation( "Automatic", pAnim );
// _LightmapAnimations.build();
set<string>::iterator itSel = setTrackNames.begin();
while ( itSel != setTrackNames.end() )
{
string ate = *itSel;
if( strncmp( itSel->c_str(), "LightmapController.", 19 ) == 0 )
{
// The light name
const char *lightName = strrchr ((*itSel).c_str (), '.')+1;
// Light animation doesn't exist ?
if (_AnimatedLightNameToIndex.find (lightName) == _AnimatedLightNameToIndex.end())
{
// Channel mixer for light anim
CChannelMixer *cm = new CChannelMixer();
cm->setAnimationSet( _AutomaticAnimationSet );
// Add an automatic animation
_AnimatedLight.push_back ( CAnimatedLightmap ((uint)_LightGroupColor.size ()) );
_AnimatedLightPtr.push_back ( &_AnimatedLight.back () );
_AnimatedLightNameToIndex.insert ( std::map<std::string, uint>::value_type (lightName, (uint32)_AnimatedLightPtr.size ()-1 ) );
CAnimatedLightmap &animLM = _AnimatedLight.back ();
animLM.setName( *itSel );
cm->addChannel( animLM.getName(), &animLM, animLM.getValue(CAnimatedLightmap::FactorValue),
animLM.getDefaultTrack(CAnimatedLightmap::FactorValue), CAnimatedLightmap::FactorValue,
CAnimatedLightmap::OwnerBit, false);
// Animated lightmap playlist
CAnimationPlaylist *pl = new CAnimationPlaylist();
pl->setAnimation( 0, i );
pl->setWrapMode( 0, CAnimationPlaylist::Repeat );
_LMAnimsAuto.addPlaylist(pl,cm);
}
}
++itSel;
}
}
}