IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

QAnimationController Class

A controller class for animations.

This class was introduced in Qt 5.9.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

QAnimationController Class

  • Header: QAnimationController

  • Since: Qt 5.9

  • CMake:

    find_package(Qt6 REQUIRED COMPONENTS 3danimation)

    target_link_libraries(mytarget PRIVATE Qt6::3danimation)

  • qmake: QT += 3danimation

  • Inherited By:

  • Instantiated By: qml-qt3d-animation-animationcontroller.xml

  • Inherits: QObject

Detailed Description

Qt3DAnimation::QAnimationController class controls the selection and playback of animations. The class can be used to find all animations from Qt3DCore::QEntity tree and create QAnimationGroups from the animations with the same name. The user can select which animation group is currently controlled with the animation controller by setting the active animation. The animation position is then propagated to that group after scaling and offsetting the provided position value with the positionScale and positionOffset values.

that the animation controller doesn't have internal timer, but instead the user is responsible for updating the position property in timely manner.

Property Documentation

 

activeAnimationGroup : int

Holds the currectly active animation group.

Access functions:

  • int activeAnimationGroup() const

  • void setActiveAnimationGroup(int index)

Notifier signal:

  • void activeAnimationGroupChanged(int index)

entity : Qt3DCore::QEntity*

Holds the entity animations are gathered and grouped from. If the controller already holds animations, they are cleared.

Access functions:

  • *entity() const

  • void setEntity( *entity)

Notifier signal:

  • void entityChanged( *entity)

position : float

Holds the current position of the animation. When the position is set, it is scaled and offset with positionScale/positionOffset and propagated to the active animation group.

Access functions:

  • float position() const

  • void setPosition(float position)

Notifier signal:

  • void positionChanged(float position)

positionOffset : float

Holds the position offset of the animation.

Access functions:

  • float positionOffset() const

  • void setPositionOffset(float offset)

Notifier signal:

  • void positionOffsetChanged(float offset)

positionScale : float

Holds the position scale of the animation.

Access functions:

  • float positionScale() const

  • void setPositionScale(float scale)

Notifier signal:

  • void positionScaleChanged(float scale)

recursive : bool

Holds whether the recursively search the entity tree when gathering animations from the entity. If set to true, the animations are searched also from the child entities of the entity. If set to false, only the entity passed to the controller is searched.

Access functions:

  • bool recursive() const

  • void setRecursive(bool recursive)

Notifier signal:

  • void recursiveChanged(bool recursive)

Member Function Documentation

 

QAnimationController::QAnimationController(QObject *parent = nullptr)

Constructs a new QAnimationController with parent.

void QAnimationController::addAnimationGroup(Qt3DAnimation::QAnimationGroup *animationGroup)

Adds the given animationGroup to the controller.

QList<Qt3DAnimation::QAnimationGroup *> QAnimationController::animationGroupList()

Returns the list of animation groups the conroller is currently holding.

int QAnimationController::getAnimationIndex(const QString &name) const

Returns the index of the animation with name. Returns -1 if no AnimationGroup with the given name is found.

Qt3DAnimation::QAnimationGroup *QAnimationController::getGroup(int index) const

Returns the AnimationGroup with the given index.

void QAnimationController::removeAnimationGroup(Qt3DAnimation::QAnimationGroup *animationGroup)

Removes the given animationGroup from the controller.

void QAnimationController::setAnimationGroups(const QList<Qt3DAnimation::QAnimationGroup *> &animationGroups)

Sets the animationGroups for the controller. Old groups are cleared.

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+