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


C++ ActorPtr::Get方法代码示例

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


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

示例1: CreateAnimation

AnimationPtr ModelActorFactory::CreateAnimation(
    Actor& rootActor,
    const ModelAnimationMap* animationData,
    AlphaFunction alpha,
    float durationSeconds)
{
    DALI_LOG_TRACE_METHOD(Debug::Filter::gModel);

    AnimationPtr animation(Animation::New(durationSeconds));
    animation->SetDefaultAlphaFunction(alpha);

    for(EntityAnimatorMapIter it = animationData->animators.begin(); it != animationData->animators.end(); ++it)
    {
        const EntityAnimatorMap& entityAnimator(*it);

        // find actor for this animator
        ActorPtr animatedActor = rootActor.FindChildByName(entityAnimator.GetEntityName());
        if (!animatedActor)
        {
            // If we can't find the actor, it may not have been instantiated, may
            // be a sibling or parent of rootActor or may have been removed.
            continue;
        }

        Dali::Actor targetActor(animatedActor.Get());

        Dali::KeyFrames posKFHandle = entityAnimator.GetPositionKeyFrames();
        if(posKFHandle)
        {
            const KeyFrames& positionKeyFrames = GetImplementation(posKFHandle);
            if(positionKeyFrames.GetKeyFramesBase()->GetNumberOfKeyFrames() > 0)
            {
                animation->AnimateBetween(Property(targetActor, Dali::Actor::POSITION),
                                          positionKeyFrames, alpha, durationSeconds);
            }
        }

        Dali::KeyFrames scaleKFHandle = entityAnimator.GetScaleKeyFrames();
        if(scaleKFHandle)
        {
            const KeyFrames& scaleKeyFrames    = GetImplementation(scaleKFHandle);
            if(scaleKeyFrames.GetKeyFramesBase()->GetNumberOfKeyFrames() > 0)
            {
                animation->AnimateBetween(Property(targetActor, Dali::Actor::SCALE),    scaleKeyFrames, alpha, durationSeconds);
            }
        }

        Dali::KeyFrames rotationKFHandle = entityAnimator.GetRotationKeyFrames();
        if(rotationKFHandle)
        {
            const KeyFrames& rotationKeyFrames = GetImplementation(rotationKFHandle);
            if(rotationKeyFrames.GetKeyFramesBase()->GetNumberOfKeyFrames() > 0)
            {
                animation->AnimateBetween(Property(targetActor, Dali::Actor::ROTATION), rotationKeyFrames, alpha, durationSeconds);
            }
        }
    }
    return animation;
}
开发者ID:Tarnyko,项目名称:dali-core,代码行数:59,代码来源:model-actor-factory-impl.cpp

示例2: BindBonesToMeshActors

void ModelActorFactory::BindBonesToMeshActors(ActorPtr rootActor, ActorPtr actorPtr)
{
    MeshActor* meshActor = dynamic_cast<MeshActor*>(actorPtr.Get());
    if(meshActor)
    {
        meshActor->BindBonesToMesh(rootActor);
    }

    // Descend to all child actors, not just mesh actors
    const ActorContainer& children = actorPtr->GetChildren();
    for ( ActorConstIter iter = children.begin(); iter != children.end(); ++iter)
    {
        ActorPtr childActor = const_cast<Actor*>(&GetImplementation(*iter));
        BindBonesToMeshActors(rootActor, childActor);
    }
}
开发者ID:Tarnyko,项目名称:dali-core,代码行数:16,代码来源:model-actor-factory-impl.cpp

示例3: RecurseNew

ActorPtr ModelActorFactory::RecurseNew(ModelDataPtr modelData, Dali::Entity entity)
{
    ActorPtr actorPtr;
    if(entity.HasMeshes())
    {
        actorPtr = Internal::MeshActor::New(modelData, entity);
    }
    else
    {
        // Root with no mesh, or bone/joint actor (with no mesh)
        actorPtr = Internal::Actor::New();
        actorPtr->SetName(entity.GetName());
        Matrix transform(entity.GetTransformMatrix());
        Vector3 position;
        Quaternion rotation;
        Vector3 scale;
        transform.GetTransformComponents(position, rotation, scale);
        actorPtr->SetPosition(position);
        actorPtr->SetRotation(rotation);
        actorPtr->SetScale(scale);
    }

    actorPtr->SetParentOrigin(ParentOrigin::CENTER);
    actorPtr->SetAnchorPoint(AnchorPoint::CENTER);

    if (entity.HasChildren())
    {
        for (EntityConstIter iter = entity.GetChildren().begin(); iter != entity.GetChildren().end(); ++iter)
        {
            Dali::Entity childEntity = (*iter);
            ActorPtr child = RecurseNew(modelData, childEntity);
            actorPtr->Add(*child.Get());
        }
    }

    return actorPtr;
}
开发者ID:Tarnyko,项目名称:dali-core,代码行数:37,代码来源:model-actor-factory-impl.cpp


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