このページでは

InstanceList QML Type

QML でインスタンス化を手動で指定できるようになります。詳細...

Import Statement: import QtQuick3D
Inherits:

Instancing

プロパティ

詳細な説明

InstanceList 型を使用すると、QML でインスタンステーブルを手動で定義することができます。

次の例は、2つの項目を持つインスタンステーブルを作成します:

InstanceList {
    id: manualInstancing
    instances: [
        InstanceListEntry {
            position: Qt.vector3d(0, 0, -60)
            eulerRotation: Qt.vector3d(-10, 0, 30)
            color: "red"
        },
        InstanceListEntry {
            position: Qt.vector3d(50, 10, 100)
            eulerRotation: Qt.vector3d(0, 180, 0)
            color: "green"
        }
    ]
}

また、InstanceList に子要素を追加するだけで、instances プロパティにデータを設定することも可能です。次の例は、前の例と同等です:

InstanceList {
    id: manualInstancing
    InstanceListEntry {
        position: Qt.vector3d(0, 0, -60)
        eulerRotation: Qt.vector3d(-10, 0, 30)
        color: "red"
    }
    InstanceListEntry {
        position: Qt.vector3d(50, 10, 100)
        eulerRotation: Qt.vector3d(0, 180, 0)
        color: "green"
    }
}

各InstanceListEntry は、プロパティのバインディングやアニメーションを設定できるオブジェクトです。これにより高い柔軟性が得られますが、メモリのオーバーヘッドも生じます。 したがって、数千(あるいは数百万)ものインスタンスを含む手続き的に生成されたテーブルには、InstanceList を使用することは推奨されません。また、エントリのプロパティが変更されると、インスタンステーブル全体が再計算され、GPU にアップロードされます。

「 RandomInstancing 」および「QQuick3DInstancing 」も参照してください 。

プロパティのドキュメント

instanceCount : int [since 6.3]

この読み取り専用プロパティには、リスト内のインスタンス数が格納されます。

このプロパティは Qt 6.3 で導入されました。

instances : List<QtQuick3D::InstanceListEntry> [default]

このプロパティには、インスタンス定義のリストが含まれています。このリストまたはその要素のいずれかを変更すると、インスタンステーブルが更新されます。

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