QBlendedClipAnimator Class

class Qt3DAnimation::QBlendedClipAnimator

QBlendedClipAnimatorは、ブレンドノードのツリーのアニメーション再生機能を提供するコンポーネントです。もっと詳しく...

ヘッダー #include <QBlendedClipAnimator>
CMake: find_package(Qt6 REQUIRED COMPONENTS 3danimation)
target_link_libraries(mytarget PRIVATE Qt6::3danimation)
qmake QT += 3danimation
QML で BlendedClipAnimator
を継承しています: Qt3DAnimation::QAbstractClipAnimator
ステータス非推奨

プロパティ

  • blendTree : Qt3DAnimation::QAbstractClipBlendNode*

パブリック機能

Qt3DAnimation::QAbstractClipBlendNode *blendTree() const

パブリックスロット

void setBlendTree(Qt3DAnimation::QAbstractClipBlendNode *blendTree)

シグナル

void blendTreeChanged(Qt3DAnimation::QAbstractClipBlendNode *blendTree)

詳細説明

QBlendedClipAnimator のインスタンスを QEntity に集約することで、アニメーション クリップを再生したり、計算されたアニメーション値を QObject のプロパティに適用したりする機能を追加できます。

QClipAnimator が単一のアニメーション クリップからアニメーション データを取得するのに対し、QBlendedClipAnimator は複数のクリップをブレンドできます。アニメーションデータは、いわゆるブレンドツリーを評価することで得られます。ブレンド・ツリーは階層ツリー構造で、リーフ・ノードはアニメーション・クリップ(QAbstractAnimationClip )をカプセル化した値ノードです。内部ノードは、オペランド・プロパティが指すノードを操作するブレンド操作を表します。

ブレンド・ツリーをQBlendedClipAnimatorに関連付けるには、アニメーターのblendTree プロパティを設定して、ブレンド・ツリーのルート・ノードを指定します:

auto blendTreeRoot = new QAdditiveClipBlend();
...
auto animator = new QBlendedClipAnimator();
animator->setBlendTree(blendTreeRoot);

ブレンドツリーは、以下のノードタイプから構築できます:

注意: ブレンドノードツリーは、アニメーターが動作していない時に編集してください。

ブレンドノードツリーは、アニメーターが動作していない時に編集してください。

例として、次のブレンドツリーを考えてみましょう:

Clip0----
        |
        Lerp Node----
        |           |
Clip1----           Additive Node
                    |
            Clip2----

次のように作成し、使用します:

// Create leaf nodes of blend tree
auto clip0 = new QClipBlendValue(
    new QAnimationClipLoader(QUrl::fromLocalFile("walk.json")));
auto clip1 = new QClipBlendValue(
    new QAnimationClipLoader(QUrl::fromLocalFile("run.json")));
auto clip2 = new QClipBlendValue(
    new QAnimationClipLoader(QUrl::fromLocalFile("wave-arm.json")));

// Create blend tree inner nodes
auto lerpNode = new QLerpClipBlend();
lerpNode->setStartClip(clip0);
lerpNode->setEndClip(clip1);
lerpNode->setBlendFactor(0.5f); // Half-walk, half-run

auto additiveNode = new QAdditiveClipBlend();
additiveNode->setBaseClip(lerpNode); // Comes from lerp sub-tree
additiveNode->setAdditiveClip(clip2);
additiveNode->setAdditiveFactor(1.0f); // Wave arm fully

// Run the animator
auto animator = new QBlendedClipAnimator();
animator->setBlendTree(additiveNode);
animator->setChannelMapper(...);
animator->setRunning(true);

アニメーションクリップのセットをオーサリングし、実行時にブレンドツリーを使って動的にクリップ間をブレンドすることで、膨大なアニメーションが可能になります。上記のブレンドツリーの簡単な例として、アルファが加算係数、ベータがレープのブレンド係数で、2Dの連続したアニメーションが可能です:

(alpha = 0, beta = 1) Running, No arm waving --- (alpha = 1, beta = 1) Running, Arm waving
        |                                               |
        |                                               |
        |                                               |
(alpha = 0, beta = 0) Walking, No arm waving --- (alpha = 0, beta = 1) Running, No arm waving

より複雑なブレンドツリーでは、アニメーションクリップを組み合わせる柔軟性がさらに高まります。ブレンドツリーをコントロールするための値(上記のアルファとベータ)は、ブレンドノードの単純なプロパティです。つまり、これらのプロパティ自体も、アニメーションフレームワークで制御できます。

プロパティの説明

blendTree : Qt3DAnimation::QAbstractClipBlendNode*

このプロパティは、アニメーターによって補間される前に評価されるアニメーションブレンドツリーのルートを保持します。

アクセス関数

Qt3DAnimation::QAbstractClipBlendNode *blendTree() const
void setBlendTree(Qt3DAnimation::QAbstractClipBlendNode *blendTree)

Notifierシグナル:

void blendTreeChanged(Qt3DAnimation::QAbstractClipBlendNode *blendTree)

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.