当前位置: 首页>>代码示例>>C++>>正文


C++ Animation::GetNameHash方法代码示例

本文整理汇总了C++中Animation::GetNameHash方法的典型用法代码示例。如果您正苦于以下问题:C++ Animation::GetNameHash方法的具体用法?C++ Animation::GetNameHash怎么用?C++ Animation::GetNameHash使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Animation的用法示例。


在下文中一共展示了Animation::GetNameHash方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Play

bool AnimationController::Play(const String& name, unsigned char layer, bool looped, float fadeInTime)
{
    // Check if already exists
    unsigned index;
    AnimationState* state;
    FindAnimation(name, index, state);

    if (!state)
    {
        Animation* newAnimation = GetSubsystem<ResourceCache>()->GetResource<Animation>(name);
        state = AddAnimationState(newAnimation);
        if (!state)
            return false;
    }

    if (index == M_MAX_UNSIGNED)
    {
        AnimationControl newControl;
        Animation* animation = state->GetAnimation();
        newControl.name_ = animation->GetName();
        newControl.hash_ = animation->GetNameHash();
        animations_.Push(newControl);
        index = animations_.Size() - 1;
    }

    state->SetLayer(layer);
    state->SetLooped(looped);
    animations_[index].targetWeight_ = 1.0f;
    animations_[index].fadeTime_ = fadeInTime;

    MarkNetworkUpdate();
    return true;
}
开发者ID:nonconforme,项目名称:Urho3D,代码行数:33,代码来源:AnimationController.cpp

示例2: GetAnimationState

AnimationState* AnimatedModel::GetAnimationState(StringHash animationNameHash) const
{
    for (Vector<SharedPtr<AnimationState> >::ConstIterator i = animationStates_.Begin(); i != animationStates_.End(); ++i)
    {
        Animation* animation = (*i)->GetAnimation();
        if (animation)
        {
            // Check both the animation and the resource name
            if (animation->GetNameHash() == animationNameHash || animation->GetAnimationNameHash() == animationNameHash)
                return *i;
        }
    }

    return nullptr;
}
开发者ID:iSLC,项目名称:Urho3D,代码行数:15,代码来源:AnimatedModel.cpp

示例3: GetAnimationState

AnimationState* AnimationController::GetAnimationState(StringHash nameHash) const
{
    // Model mode
    AnimatedModel* model = GetComponent<AnimatedModel>();
    if (model)
        return model->GetAnimationState(nameHash);

    // Node hierarchy mode
    for (Vector<SharedPtr<AnimationState> >::ConstIterator i = nodeAnimationStates_.Begin(); i != nodeAnimationStates_.End(); ++i)
    {
        Animation* animation = (*i)->GetAnimation();
        if (animation->GetNameHash() == nameHash || animation->GetAnimationNameHash() == nameHash)
            return *i;
    }

    return 0;
}
开发者ID:nonconforme,项目名称:Urho3D,代码行数:17,代码来源:AnimationController.cpp

示例4: GetAnimationState

AnimationState* AnimationController::GetAnimationState(StringHash nameHash) const
{
    // Model mode
    auto* model = GetComponent<AnimatedModel>();
    if (model)
        return model->GetAnimationState(nameHash);

    // Node hierarchy mode
    for (auto i = nodeAnimationStates_.begin(); i != nodeAnimationStates_.end(); ++i)
    {
        Animation* animation = (*i)->GetAnimation();
        if (animation->GetNameHash() == nameHash || animation->GetAnimationNameHash() == nameHash)
            return *i;
    }

    return nullptr;
}
开发者ID:,项目名称:,代码行数:17,代码来源:

示例5: RemoveAnimationState

void AnimatedModel::RemoveAnimationState(StringHash animationNameHash)
{
    for (Vector<SharedPtr<AnimationState> >::Iterator i = animationStates_.Begin(); i != animationStates_.End(); ++i)
    {
        AnimationState* state = *i;
        Animation* animation = state->GetAnimation();
        if (animation)
        {
            // Check both the animation and the resource name
            if (animation->GetNameHash() == animationNameHash || animation->GetAnimationNameHash() == animationNameHash)
            {
                animationStates_.Erase(i);
                MarkAnimationDirty();
                return;
            }
        }
    }
}
开发者ID:iSLC,项目名称:Urho3D,代码行数:18,代码来源:AnimatedModel.cpp

示例6: GetAnimationStatesAttr

VariantVector AnimatedModel::GetAnimationStatesAttr() const
{
    VariantVector ret;
    ret.Reserve(animationStates_.Size() * 6 + 1);
    ret.Push(animationStates_.Size());
    for (Vector<SharedPtr<AnimationState> >::ConstIterator i = animationStates_.Begin(); i != animationStates_.End(); ++i)
    {
        AnimationState* state = *i;
        Animation* animation = state->GetAnimation();
        Bone* startBone = state->GetStartBone();
        ret.Push(ResourceRef(Animation::GetTypeStatic(), animation ? animation->GetNameHash() : StringHash()));
        ret.Push(startBone ? startBone->name_ : String::EMPTY);
        ret.Push(state->IsLooped());
        ret.Push(state->GetWeight());
        ret.Push(state->GetTime());
        ret.Push((int)state->GetLayer());
    }
    return ret;
}
开发者ID:zhaojunmeng,项目名称:urho3d,代码行数:19,代码来源:AnimatedModel.cpp

示例7: Play

bool AnimationController::Play(const String& name, unsigned char layer, bool looped, float fadeInTime)
{
    // Get the animation resource first to be able to get the canonical resource name
    // (avoids potential adding of duplicate animations)
    Animation* newAnimation = GetSubsystem<ResourceCache>()->GetResource<Animation>(name);
    if (!newAnimation)
        return false;

    // Check if already exists
    unsigned index;
    AnimationState* state;
    FindAnimation(newAnimation->GetName(), index, state);

    if (!state)
    {
        state = AddAnimationState(newAnimation);
        if (!state)
            return false;
    }

    if (index == M_MAX_UNSIGNED)
    {
        AnimationControl newControl;
        newControl.name_ = newAnimation->GetName();
        newControl.hash_ = newAnimation->GetNameHash();
        animations_.Push(newControl);
        index = animations_.Size() - 1;
    }

    state->SetLayer(layer);
    state->SetLooped(looped);
    animations_[index].targetWeight_ = 1.0f;
    animations_[index].fadeTime_ = fadeInTime;

    MarkNetworkUpdate();
    return true;
}
开发者ID:03050903,项目名称:Urho3D,代码行数:37,代码来源:AnimationController.cpp

示例8: Play

bool AnimationController::Play(const String& name, unsigned char layer, bool looped, float fadeInTime)
{
// ATOMIC BEGIN

    Animation* newAnimation = 0;

    // Check if we're using attached animation resource
    if (animation_.NotNull() && animation_->GetAnimationName() == name)
    {
        newAnimation = animation_;
    }
    else
    {
        for (unsigned i = 0; i < animationResources_.Size(); i++)
        {
            if (name == animationResources_[i]->GetAnimationName())
            {
                newAnimation = animationResources_[i];
                break;
            }
        }
    }

    // Get the animation resource first to be able to get the canonical resource name
    // (avoids potential adding of duplicate animations)
    if (!newAnimation)
        newAnimation = GetSubsystem<ResourceCache>()->GetResource<Animation>(name);

    if (!newAnimation)
        return false;

// ATOMIC END

    // Check if already exists
    unsigned index;
    AnimationState* state;
    FindAnimation(newAnimation->GetName(), index, state);

    if (!state)
    {
        state = AddAnimationState(newAnimation);
        if (!state)
            return false;
    }

    if (index == M_MAX_UNSIGNED)
    {
        AnimationControl newControl;
        newControl.name_ = newAnimation->GetName();
        newControl.hash_ = newAnimation->GetNameHash();
        animations_.Push(newControl);
        index = animations_.Size() - 1;
    }

    state->SetLayer(layer);
    state->SetLooped(looped);
    animations_[index].targetWeight_ = 1.0f;
    animations_[index].fadeTime_ = fadeInTime;

    MarkNetworkUpdate();
    return true;
}
开发者ID:EternalXY,项目名称:AtomicGameEngine,代码行数:62,代码来源:AnimationController.cpp


注:本文中的Animation::GetNameHash方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。