このページでは

Qt3DAnimation::QBlendedClipAnimator Class

class Qt3DAnimation::QBlendedClipAnimator

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

ヘッダー: #include <qblendedclipanimator.h>
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)

通知シグナル:

void blendTreeChanged(Qt3DAnimation::QAbstractClipBlendNode *blendTree)

© 2026 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.