本文整理汇总了C++中ISkeletonAnim类的典型用法代码示例。如果您正苦于以下问题:C++ ISkeletonAnim类的具体用法?C++ ISkeletonAnim怎么用?C++ ISkeletonAnim使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ISkeletonAnim类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CRY_ASSERT
void CLipSyncProvider_TransitionQueue::StartLipSync(IEntityAudioProxy* pProxy, const AudioControlId audioTriggerId, const ELipSyncMethod lipSyncMethod)
{
CRY_ASSERT(pProxy);
CRY_ASSERT(audioTriggerId != INVALID_AUDIO_CONTROL_ID);
CRY_ASSERT((m_state == eS_Requested) || (m_state == eS_Unpaused));
if (lipSyncMethod != eLSM_None)
{
m_soundId = audioTriggerId;
m_isSynchronized = false;
if (ICharacterInstance* pChar = GetCharacterInstance())
{
if (m_requestedAnimId >= 0)
{
ISkeletonAnim* skeletonAnimation = pChar->GetISkeletonAnim();
const bool success = skeletonAnimation->StartAnimationById(m_requestedAnimId, m_requestedAnimParams);
if (success)
{
m_nCurrentAnimationToken = m_requestedAnimParams.m_nUserToken;
SynchronizeAnimationToSound(audioTriggerId);
}
else
{
m_nCurrentAnimationToken = -1;
}
}
}
}
m_state = eS_Started;
}
示例2: SetDrivingProxy
//------------------------------------------------------------------------
void CVehiclePartAnimated::Reset()
{
CVehiclePartBase::Reset();
SetDrivingProxy(false);
if (m_slot > -1 && m_pCharInstance)
{
ISkeletonAnim* pSkeletonAnim = m_pCharInstance->GetISkeletonAnim();
CRY_ASSERT(pSkeletonAnim);
ISkeletonPose* pSkeletonPose = m_pCharInstance->GetISkeletonPose();
CRY_ASSERT(pSkeletonPose);
IDefaultSkeleton &rIDefaultSkeleton = m_pCharInstance->GetIDefaultSkeleton();
pSkeletonAnim->StopAnimationsAllLayers();
pSkeletonPose->SetDefaultPose();
pSkeletonPose->SetForceSkeletonUpdate(0);
for (int i = 0; i < rIDefaultSkeleton.GetJointCount(); ++i)
{
pSkeletonPose->SetMaterialOnJoint(i, NULL);
}
}
m_iRotChangedFrameId = 0;
}
示例3: PlayAnimation
bool CBoidObject::PlayAnimation( const char *animation, bool bLooped, float fBlendTime )
{
bool playing = false;
if (m_object)
{
ISkeletonAnim* pSkeleton = m_object->GetISkeletonAnim();
assert(pSkeleton);
CryCharAnimationParams animParams;
if (bLooped)
animParams.m_nFlags |= CA_LOOP_ANIMATION;
animParams.m_fTransTime = fBlendTime;
const int amountAnimationsInFIFO = pSkeleton->GetNumAnimsInFIFO(0);
const uint32 maxAnimationsAllowedInQueue = 2;
if(amountAnimationsInFIFO >= maxAnimationsAllowedInQueue)
{
animParams.m_nFlags |= CA_REMOVE_FROM_FIFO;
}
playing = pSkeleton->StartAnimation( animation, animParams );
assert(pSkeleton->GetNumAnimsInFIFO(0) <= maxAnimationsAllowedInQueue);
m_object->SetPlaybackScale( 1.0f );
}
return playing;
}
示例4:
CAnimation *CAnimationProxyDualCharacter::GetAnimation(IEntity *entity, int32 layer, uint32 token)
{
ICharacterInstance* pIShadowCharacter = m_firstPersonMode ? entity->GetCharacter(m_characterShadow) : NULL;
ICharacterInstance* pICharacter = pIShadowCharacter ? pIShadowCharacter : entity->GetCharacter(m_characterMain);
if (pICharacter)
{
ISkeletonAnim* pISkeletonAnim = pICharacter->GetISkeletonAnim();
int nAnimsInFIFO = pISkeletonAnim->GetNumAnimsInFIFO(layer);
if (nAnimsInFIFO == 0)
{
return NULL;
}
if (token == INVALID_ANIMATION_TOKEN)
{
return &pISkeletonAnim->GetAnimFromFIFO(layer, 0);
}
else
{
return pISkeletonAnim->FindAnimInFIFO(token, layer);
}
}
return NULL;
}
示例5: GetEntity
void CLivingEntitySample::ResetCharacterModel()
{
IEntity* pEntity = GetEntity();
const int slot = 0;
const char* modelFilename = DEFAULT_MODEL_NAME;
pEntity->LoadCharacter( slot, modelFilename );
ICharacterInstance* pCharacterInstance = pEntity->GetCharacter( slot );
if ( pCharacterInstance == NULL )
{
return;
}
ISkeletonAnim* pSkeletonAnim = pCharacterInstance->GetISkeletonAnim();
if ( pSkeletonAnim == NULL )
{
return;
}
ISkeletonPose* pSkeletonPose = pCharacterInstance->GetISkeletonPose();
if ( pSkeletonPose == NULL )
{
return;
}
pSkeletonPose->SetFootAnchoring( 1 );
pSkeletonAnim->SetAnimationDrivenMotion( 1 );
// We will want to set motion parameters directly ourselves for this sample:
pSkeletonAnim->SetCharEditMode( 1 );
}
示例6: Pause
void CActionScope::Pause()
{
if (!m_scopeContext.charInst)
{
return;
}
ISkeletonAnim *pSkeletonAnim = m_scopeContext.charInst->GetISkeletonAnim();
if (!pSkeletonAnim)
{
return;
}
for (int i = 0; i < m_numLayers; ++i)
{
SSequencer &sequencer = m_layerSequencers[i];
const int animationLayer = m_layer + i;
const int animationsInLayer = pSkeletonAnim->GetNumAnimsInFIFO(animationLayer);
if (animationsInLayer == 0)
{
sequencer.savedAnimNormalisedTime = -1;
}
else
{
const int lastAnimationIndex = animationsInLayer - 1;
const CAnimation &animation = pSkeletonAnim->GetAnimFromFIFO(animationLayer, lastAnimationIndex);
sequencer.savedAnimNormalisedTime = pSkeletonAnim->GetAnimationNormalizedTime(&animation);
}
}
}
示例7: CRY_ASSERT_MESSAGE
void CActionScope::StopAnimationOnLayer(uint32 layer, float blendTime)
{
CRY_ASSERT_MESSAGE(layer < m_numLayers, "Overrunning scope!");
ISkeletonAnim *pSkelAnim = m_scopeContext.charInst->GetISkeletonAnim();
const uint32 actualLayer = layer + m_layer;
pSkelAnim->StopAnimationInLayer(actualLayer, blendTime);
}
示例8: InstallAnimation
bool CActionScope::InstallAnimation(int animID, const CryCharAnimationParams &animParams)
{
ISkeletonAnim *pSkelAnim = m_scopeContext.charInst->GetISkeletonAnim();
const bool startAnimationSuccess = pSkelAnim->StartAnimationById(animID, animParams);
pSkelAnim->SetLayerPlaybackScale(animParams.m_nLayerID, m_speedBias);
pSkelAnim->SetLayerBlendWeight(animParams.m_nLayerID, m_animWeight);
return startAnimationSuccess;
}
示例9: assert
void CMountedGunController::ReplayStopThirdPersonAnimations( ICharacterInstance* pCharacter )
{
assert(pCharacter);
ISkeletonAnim *pSkeletonAnim = pCharacter->GetISkeletonAnim();
assert(pSkeletonAnim);
pSkeletonAnim->StopAnimationInLayer(REPLAY_PLAYER_ANIMATION_LAYER_AIM_UP, 0.1f);
pSkeletonAnim->StopAnimationInLayer(REPLAY_PLAYER_ANIMATION_LAYER_AIM_DOWN, 0.1f);
}
示例10: StopAnimationInLayer
void CScriptbind_Entity::StopAnimationInLayer(IEntity *pEntity, int slot, int layer, float blendOutTime)
{
ICharacterInstance *pCharacter = pEntity->GetCharacter(slot);
if(!pCharacter)
return;
ISkeletonAnim *pSkeletonAnim = pCharacter->GetISkeletonAnim();
if(!pSkeletonAnim)
return;
pSkeletonAnim->StopAnimationInLayer(layer, blendOutTime);
}
示例11: StopAnimationsInAllLayers
void CScriptbind_Entity::StopAnimationsInAllLayers(IEntity *pEntity, int slot)
{
ICharacterInstance *pCharacter = pEntity->GetCharacter(slot);
if(!pCharacter)
return;
ISkeletonAnim *pSkeletonAnim = pCharacter->GetISkeletonAnim();
if(!pSkeletonAnim)
return;
pSkeletonAnim->StopAnimationsAllLayers();
}
示例12: RemoveAnimationInLayer
bool CAnimationProxyDualCharacterUpper::RemoveAnimationInLayer(IEntity *entity, int32 nLayer, uint32 token)
{
ICharacterInstance* pIShadowCharacter = m_firstPersonMode ? entity->GetCharacter(m_characterShadow) : NULL;
ICharacterInstance* pICharacter = pIShadowCharacter ? pIShadowCharacter : entity->GetCharacter(m_characterMain);
if (pICharacter)
{
ISkeletonAnim* pISkeletonAnim = pICharacter->GetISkeletonAnim();
if (pIShadowCharacter)
{
ISkeletonAnim* pIShadowSkeletonAnim = pIShadowCharacter->GetISkeletonAnim();
int nAnimsInFIFO = pIShadowSkeletonAnim->GetNumAnimsInFIFO(nLayer);
for (int i=0; i<nAnimsInFIFO; ++i)
{
const CAnimation& anim = pIShadowSkeletonAnim->GetAnimFromFIFO(nLayer, i);
if (anim.HasUserToken(token))
{
pIShadowSkeletonAnim->RemoveAnimFromFIFO(nLayer, i);
}
}
}
int nAnimsInFIFO = pISkeletonAnim->GetNumAnimsInFIFO(nLayer);
for (int i=0; i<nAnimsInFIFO; ++i)
{
const CAnimation& anim = pISkeletonAnim->GetAnimFromFIFO(nLayer, i);
if (anim.HasUserToken(token))
{
return pISkeletonAnim->RemoveAnimFromFIFO(nLayer, i);
}
}
}
return false;
}
示例13:
CAnimation *CActionScope::GetTopAnim(int layer)
{
CAnimation *anim = NULL;
if (m_scopeContext.charInst)
{
ISkeletonAnim *pISkeletonAnim = m_scopeContext.charInst->GetISkeletonAnim();
int nAnimsInFIFO = pISkeletonAnim->GetNumAnimsInFIFO(m_layer + layer);
if (nAnimsInFIFO > 0)
{
anim = &pISkeletonAnim->GetAnimFromFIFO(m_layer + layer, nAnimsInFIFO-1);
}
}
return anim;
}
示例14: Flush
void CActionScope::Flush(EFlushMethod flushMethod)
{
ISkeletonAnim *pSkelAnim = m_scopeContext.charInst.get() ? m_scopeContext.charInst->GetISkeletonAnim() : NULL;
for (uint32 i=0; i<m_numLayers; i++)
{
SSequencer &sequencer = m_layerSequencers[i];
//const uint32 numAnims = sequencer.sequence.size();
sequencer.sequence.resize(0);
sequencer.installTime = -1.0f;
sequencer.pos = 0;
sequencer.flags = 0;
//clear FIFO regardless of whether actionscope believes it has animations in the sequence or not
//fixes issue where clearing a scope context wouldn't clear all animations because an empty fragment gets queued first clearing the sequencer
if (/*(numAnims > 0) &&*/ pSkelAnim && (flushMethod != FM_NormalLeaveAnimations))
{
pSkelAnim->ClearFIFOLayer(m_layer + i);
}
}
const int numProcs = m_procSequencers.size();
for (uint32 i=0; i<numProcs; i++)
{
SProcSequencer &procSeq = m_procSequencers[i];
if (procSeq.proceduralClip)
{
switch(flushMethod)
{
case FM_Normal:
case FM_NormalLeaveAnimations:
procSeq.proceduralClip->OnExit(0.0f);
break;
case FM_Failure:
procSeq.proceduralClip->OnFail();
break;
default:
CRY_ASSERT(false);
}
}
}
m_procSequencers.resize(0);
m_lastFragmentID = FRAGMENT_ID_INVALID;
m_fragmentTime = 0.0f;
m_lastFragSelection = SFragmentSelection();
m_lastQueueTagState = SFragTagState();
m_sequenceFlags = 0;
}
示例15: GetEntity
//------------------------------------------------------------------------
void CReplayActor::PlayUpperAnimation(int animId, const CryCharAnimationParams& params, float speedMultiplier, float animTime)
{
float adjustedLayerTime = 0;
ICharacterInstance* pCharacterInstance = GetEntity()->GetCharacter(0);
if (animTime == 0 || GetAdjustedLayerTime(pCharacterInstance, animId, params, speedMultiplier, animTime, adjustedLayerTime))
{
m_animationProxyUpper.StartAnimationById(GetEntity(), animId, params, speedMultiplier);
ISkeletonAnim* pSkeletonAnim = pCharacterInstance->GetISkeletonAnim();
pSkeletonAnim->SetLayerNormalizedTime(params.m_nLayerID, adjustedLayerTime);
ICharacterInstance* pShadowCharacter = GetShadowCharacter();
if (pShadowCharacter)
{
pShadowCharacter->GetISkeletonAnim()->SetLayerNormalizedTime(params.m_nLayerID, adjustedLayerTime);
}
}
}