Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qssgscenedesc_p.h
Go to the documentation of this file.
1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5
6#ifndef QSSGSCENEDESCRIPTION_P_H
7#define QSSGSCENEDESCRIPTION_P_H
8
9#include <QtQuick3DAssetUtils/private/qtquick3dassetutilsglobal_p.h>
10#include <QtQuick3DRuntimeRender/private/qssgrendergraphobject_p.h>
11#include <QtQuick3DRuntimeRender/private/qssgperframeallocator_p.h>
12#include <QtQuick3DUtils/private/qssgmesh_p.h>
13
14#include <QtCore/qlist.h>
15#include <QtCore/qhash.h>
16#include <QtCore/qvariant.h>
17#include <QtCore/qflags.h>
18#include <QtQml/qqmllist.h>
19
20// QtQuick3D
21#include <QtQuick3D/private/qquick3dobject_p.h>
22// Materials
23#include <QtQuick3D/private/qquick3dcustommaterial_p.h>
24#include <QtQuick3D/private/qquick3ddefaultmaterial_p.h>
25#include <QtQuick3D/private/qquick3dprincipledmaterial_p.h>
26#include <QtQuick3D/private/qquick3dspecularglossymaterial_p.h>
27#include <QtQuick3D/private/qquick3dmodel_p.h>
28// cameras
29#include <QtQuick3D/private/qquick3dorthographiccamera_p.h>
30#include <QtQuick3D/private/qquick3dperspectivecamera_p.h>
31#include <QtQuick3D/private/qquick3dcustomcamera_p.h>
32// Lights
33#include <QtQuick3D/private/qquick3ddirectionallight_p.h>
34#include <QtQuick3D/private/qquick3dpointlight_p.h>
35#include <QtQuick3D/private/qquick3dspotlight_p.h>
36// Texture
37#include <QtQuick3D/private/qquick3dtexture_p.h>
38#include <QtQuick3D/private/qquick3dcubemaptexture_p.h>
39#include <QtQuick3D/private/qquick3dtexturedata_p.h>
40//
41#include <QtQuick3D/private/qquick3dskeleton_p.h>
42#include <QtQuick3D/private/qquick3djoint_p.h>
43#include <QtQuick3D/private/qquick3dinstancing_p.h>
44
45#include <qmetatype.h>
46#include <QtQuick3DUtils/private/qssginvasivelinkedlist_p.h>
47
48#include <QtGui/qquaternion.h>
49
51
52//
53// W A R N I N G
54// -------------
55//
56// This file is not part of the Qt API. It exists purely as an
57// implementation detail. This header file may change from version to
58// version without notice, or even be removed.
59//
60// We mean it.
61//
62
63namespace QSSGSceneDesc
64{
65
66struct Node;
67struct Animation;
68
69template<typename T>
71
72struct Q_QUICK3DASSETUTILS_EXPORT Scene
73{
77
78 // Root node, usually an empty 'transform' node.
79 Node *root = nullptr;
80 QString id; // Don't make any assumption about the content of this id...
85 QStringList materialVariants; // names of the asset's material variants, if any
86 mutable quint16 nodeId = 0;
87
88 void reset();
89 void cleanup();
90};
91
92struct Q_QUICK3DASSETUTILS_EXPORT PropertyCall
93{
94 virtual ~PropertyCall() = default;
95 virtual bool set(QQuick3DObject &, const char *, const void *) = 0;
96 virtual bool set(QQuick3DObject &, const char *, const QVariant &) = 0;
97 virtual bool get(const QQuick3DObject &, const void *[]) const = 0;
98};
99
100Q_QUICK3DASSETUTILS_EXPORT void destructValue(QVariant &value);
101
102struct Flag
103{
105 int value;
106};
107
109{
110 ~Property();
111 enum class Type { Static, Dynamic };
112 QVariant value;
116};
117
119{
120 delete call;
121 destructValue(value);
122}
123
124Q_QUICK3DASSETUTILS_EXPORT void destructNode(QSSGSceneDesc::Node &node);
125
127{
128 NodeList(void * const *data, qsizetype n)
129 {
130 const auto size = sizeof(Node *) * n;
131 head = reinterpret_cast<Node **>(malloc(size));
132 memcpy(head, data, size);
133 count = n;
134 }
135 ~NodeList() { if (head) free(head); }
136 Node **head = nullptr;
138};
139
140struct Q_QUICK3DASSETUTILS_EXPORT Node
141{
142 // Node type
158
160 // Runtime type type mapping between this type and the QtQuick3D type
162
168 : Node(nullptr, type, rt) {}
169
170 virtual ~Node();
171 void cleanupChildren();
172
174 Scene *scene = nullptr;
175 QObject *obj = nullptr;
176 using ChildList = QList<Node *>;
183};
184
185template<typename T>
186static constexpr bool is_node_v = std::is_base_of_v<Node, T>;
187
188// Set up type mapping from a QQuick3D type to a SceneDesc type
189template <typename T> struct TypeMap {};
190#define QSSG_DECLARE_NODE(NODE) static_assert
191 (is_node_v<NODE>, #NODE " - does not inherit from Node!"); template
192 <> struct TypeMap<NODE::type> { using type = QSSGSceneDesc::NODE; };
193
194template<typename T>
195using as_scene_type_t = typename T::type;
196template<typename T>
197using as_node_type_t = typename TypeMap<T>::type;
198
200
201struct Q_QUICK3DASSETUTILS_EXPORT Texture : Node
202{
204 explicit Texture(Node::RuntimeType rt, const QByteArray &name = {});
205};
207
208struct Q_QUICK3DASSETUTILS_EXPORT TextureData : Node
209{
211 enum class Flags : quint8
212 {
214 };
215
221};
223
224struct Q_QUICK3DASSETUTILS_EXPORT Material : Node
225{
227 explicit Material(Node::RuntimeType rt);
228};
230
231// The mesh is a special node, as it's not really a node type but
232// a handle to a mesh that will be turned into a source URL...
233struct Q_QUICK3DASSETUTILS_EXPORT Mesh : Node
234{
236 qsizetype idx; // idx to the mesh data in the mesh data storage (see Scene).
237};
238
239struct Q_QUICK3DASSETUTILS_EXPORT Model : Node
240{
242 Model();
243 // One list per Scene::materialVariants entry, empty if not switchable
246};
248
249struct Q_QUICK3DASSETUTILS_EXPORT Camera : Node
250{
252 explicit Camera(RuntimeType rt);
253};
255
256struct Q_QUICK3DASSETUTILS_EXPORT Light : Node
257{
259 explicit Light(RuntimeType rt);
260};
262
263struct Q_QUICK3DASSETUTILS_EXPORT Skin : Node
264{
266 Skin();
267};
269
270struct Q_QUICK3DASSETUTILS_EXPORT Skeleton : Node
271{
273 Skeleton();
274 // Skeleton is a virtual node, which is added for the start of the joint heirarchy.
275 // parent - joint 1 -> parent - skeleton - joint 1
276 // - joint 2 - joint 2
277 // - model 1 - model 1
278 // - camera 1 - camera 1
280};
282
283struct Q_QUICK3DASSETUTILS_EXPORT Joint : Node
284{
286 Joint();
287};
289
290struct Q_QUICK3DASSETUTILS_EXPORT MorphTarget : Node
291{
293 MorphTarget();
294};
296
297struct Q_QUICK3DASSETUTILS_EXPORT Instancing : Node
298{
300 Instancing();
301 QByteArray instanceData; // QQuick3DInstancing::InstanceTableEntry array
303};
305
306// We keep our own list data structure, since Qt does not have a variant list where all the
307// elements have the same type, and using a list of QVariant is very inefficient
309{
310 ~ListView() { if (data) free(data); }
312 void *data = nullptr;
314};
315
316Q_QUICK3DASSETUTILS_EXPORT QMetaType listViewMetaType();
317
319{
321 {
322 enum class KeyType : quint16
323 {
324 Frame = 0x100,
325 Time = 0x200
326 };
327
336
337 ValueType getValueType() const { return ValueType(0xf & flag); }
338 KeyType getKeyType() const { return KeyType(0xf00 & flag); }
339 QVariant getValue() const {
340 switch (getValueType()) {
341 case ValueType::Number:
342 return value.x();
343 case ValueType::Vec2:
344 return value.toVector2D();
345 case ValueType::Vec3:
346 return value.toVector3D();
347 case ValueType::Vec4:
348 return value;
349 case ValueType::Quaternion:
350 return QQuaternion(value);
351 }
352 return value;
353 }
355 switch (getValueType()) {
356 case ValueType::Number:
357 return QMetaType::Float;
358 case ValueType::Vec2:
359 return QMetaType::QVector2D;
360 case ValueType::Vec3:
361 return QMetaType::QVector3D;
362 case ValueType::Vec4:
363 return QMetaType::QVector4D;
364 case ValueType::Quaternion:
365 return QMetaType::QQuaternion;
366 }
367 return QMetaType::QVector4D;
368 }
370 float time = 0.0f;
372 };
374
375 struct Channel
376 {
377 enum class TargetType : quint8
378 {
380 };
381
382 // This is a bit simplistic, but is all we support so let's keep simple.
384 {
389 Weight // for MorphMesh
390 };
391
392 Node *target = nullptr;
396 };
398
400 // It stores the length of this Animation, every keys in every channels in
401 // an animation will have the same KeyType and it will be a type of
402 // the length
403 float length = 0.0f;
404
405 float framesPerSecond = 0.0f; // for translation back to frames
406
408};
409
410// Add a child node to parent node.
411Q_QUICK3DASSETUTILS_EXPORT void addNode(Node &parent, Node &node);
412// Add node to the scene, if a node is already set the new node will
413// become a child of the root node.
414Q_QUICK3DASSETUTILS_EXPORT void addNode(Scene &scene, Node &node);
415
416template<typename> struct ListParam { enum { value = 0 }; };
417template<typename T> struct ListParam<QList<T>>
418{
419 using type = T;
420 enum { value = 1 };
421};
422
423template <typename T>
425
426template <typename T>
428{
429 enum { value = 0 };
430};
431
432template <typename R, typename... A>
433struct FuncType<R (*)(A...)>
434{
435 enum { value = sizeof...(A) == 3 };
436 using Ret = R;
437 using Arg0 = std::tuple_element_t<0, std::tuple<A...>>;
438 using Arg1 = std::tuple_element_t<1, std::tuple<A...>>;
439 using Arg2 = std::tuple_element_t<2, std::tuple<A...>>;
441};
442
443template <typename R, typename C, typename... A>
444struct FuncType<R (C::*)(A...)>
445{
446 enum { value = sizeof... (A) == 1 };
447 using Ret = R;
448 using Class = C;
449 // For now we only care about single argument functions
450 using Arg0 = std::tuple_element_t<0, std::tuple<A...>>;
452};
453
454template <typename T, typename C>
456{
457 enum { value = 2 };
459 using Class = C;
460 using Arg0 = void;
461 using Arg0Base = Arg0;
462};
463
464template <typename Ret, typename Arg>
466{
467 using Setter = Ret (*)(QQuick3DObject &, const char *, Arg);
468 constexpr explicit PropertyProxySetter(Setter fn) : call(fn) {}
469 Setter call = nullptr;
470 bool get(const QQuick3DObject &, const void *[]) const override { return false; }
471 bool set(QQuick3DObject &that, const char *name, const void *value) override
472 {
473 if constexpr (std::is_pointer_v<typename FuncType<Setter>::Arg2>)
474 call(that, name, reinterpret_cast<typename FuncType<Setter>::Arg2>(const_cast<void *>(value)));
475 else
476 call(that, name, *reinterpret_cast<typename FuncType<Setter>::Arg2Base *>(const_cast<void *>(value)));
477 return true;
478 }
479 bool set(QQuick3DObject &that, const char *name, const QVariant &var) override
480 {
481 call(that, name, qvariant_cast<typename FuncType<Setter>::Arg2Base>(var));
482 return true;
483 }
484};
485
486template <typename Ret, typename Class, typename Arg>
488{
489 using Setter = Ret (Class::*)(Arg);
490 constexpr explicit PropertySetter(Setter fn) : call(fn) {}
491 Setter call = nullptr;
492 bool get(const QQuick3DObject &, const void *[]) const override { return false; }
493 bool set(QQuick3DObject &that, const char *, const void *value) override
494 {
495 if constexpr (std::is_pointer_v<typename FuncType<Setter>::Arg0>)
496 (qobject_cast<Class *>(&that)->*call)(reinterpret_cast<typename FuncType<Setter>::Arg0>(const_cast<void *>(value)));
497 else {
498 (qobject_cast<Class *>(&that)->*call)(*reinterpret_cast<typename FuncType<Setter>::Arg0Base *>(const_cast<void *>(value)));
499 }
500 return true;
501 }
502 bool set(QQuick3DObject &that, const char *, const QVariant &var) override
503 {
504 (qobject_cast<Class *>(&that)->*call)(qvariant_cast<typename FuncType<Setter>::Arg0Base>(var));
505 return true;
506 }
507};
508
509template <typename Ret, typename Class, typename Arg>
511{
512 using Setter = Ret (Class::*)(Arg);
513 using ListT = typename FuncType<Setter>::Arg0Base;
515 constexpr explicit PropertyListSetter(Setter fn) : call(fn) {}
516 Setter call = nullptr;
517 bool get(const QQuick3DObject &, const void *[]) const override { return false; }
518 bool set(QQuick3DObject &that, const char *, const void *value) override
519 {
520 if (const auto listView = reinterpret_cast<const ListView *>(value)) {
521 if (listView->count > 0) {
522 const auto begin = reinterpret_cast<It *>(listView->data);
523 const auto end = reinterpret_cast<It *>(listView->data) + listView->count;
524 (qobject_cast<Class *>(&that)->*call)(ListT{begin, end});
525 } else {
526 (qobject_cast<Class *>(&that)->*call)(ListT{});
527 }
528 return true;
529 }
530
531 return false;
532 }
533 bool set(QQuick3DObject &that, const char *, const QVariant &var) override
534 {
535 if (const auto listView = qvariant_cast<const ListView *>(var)) {
536 if (listView->count > 0) {
537 const auto begin = reinterpret_cast<It *>(listView->data);
538 const auto end = reinterpret_cast<It *>(listView->data) + listView->count;
539 (qobject_cast<Class *>(&that)->*call)(ListT{begin, end});
540 } else {
541 (qobject_cast<Class *>(&that)->*call)(ListT{});
542 }
543 }
544 return false;
545 }
546};
547
548template <typename Class, typename T, template <typename> typename List>
550{
551 using ListType = List<T>;
552 using ListFunc = ListType (Class::*)();
553 constexpr explicit PropertyList(ListFunc fn) : listfn(fn) {}
554 ListFunc listfn = nullptr;
555
556 static_assert(std::is_same_v<ListType, QQmlListProperty<T>>, "Expected QQmlListProperty!");
557
558 bool get(const QQuick3DObject &, const void *[]) const override { return false; }
559
560
561 void doSet(QQuick3DObject &that, const QSSGSceneDesc::NodeList &nodeList)
562 {
563 ListType list = (qobject_cast<Class *>(&that)->*listfn)();
564 auto head = reinterpret_cast<as_node_type_t<T> **>(nodeList.head);
565 for (int i = 0, end = nodeList.count; i != end; ++i)
566 list.append(&list, qobject_cast<T *>((*(head + i))->obj));
567 }
568
569 bool set(QQuick3DObject &that, const char *, const void *value) override
570 {
571 if (value) {
572 const auto &nodeList = *reinterpret_cast<const QSSGSceneDesc::NodeList *>(value);
573 doSet(that, nodeList);
574 return true;
575 }
576 return false;
577 }
578
579 bool set(QQuick3DObject &that, const char *, const QVariant &var) override
580 {
581 const auto *nodeList = qvariant_cast<const QSSGSceneDesc::NodeList *>(var);
582 if (nodeList) {
583 doSet(that, *nodeList);
584 return true;
585 }
586 return false;
587 }
588};
589
590template <typename NodeT>
591using if_node = typename std::enable_if_t<is_node_v<NodeT>, bool>;
592template <typename Setter, typename Value>
594template <typename Setter, typename T>
596template <typename Setter, typename Value>
598
599// Sets a property on a node, the property is a name map to struct containing a pointer to the value and a function
600// to set the value on an runtime object (QtQuick3DObject). The type is verified at compile-time, so we can assume
601// the value is of the right type when setting it at run-time.
602template<typename Setter, typename T, if_compatible_t<Setter, T> = false>
603static void setProperty(QSSGSceneDesc::Node &node, const char *name, Setter setter, T &&value)
604{
605 Q_ASSERT(node.scene);
606 auto prop = new Property;
607 prop->name = name;
608 prop->call = new PropertySetter(setter);
609 prop->value = QVariant::fromValue(std::forward<T>(value));
610 node.properties.push_back(prop);
611}
612
613template<typename Setter, typename T, if_compatible_t<Setter, QFlags<T>> = false>
614static void setProperty(QSSGSceneDesc::Node &node, const char *name, Setter setter, QFlags<T> value)
615{
616 Q_ASSERT(node.scene);
617 auto prop = new Property;
618 prop->name = name;
619 prop->call = new PropertySetter(setter);
620 prop->value = QVariant::fromValue(Flag{ QMetaEnum::fromType<rm_cvref_t<T>>(), value.toInt() });
621 node.properties.push_back(prop);
622}
623
624
625template<typename Setter, typename T, if_compatible_t<Setter, QList<T>> = false>
626static void setProperty(QSSGSceneDesc::Node &node, const char *name, Setter setter, QList<T> value)
627{
628 Q_ASSERT(node.scene);
629 static_assert(!std::is_pointer_v<T>, "Type cannot be a pointer!");
630 static_assert(std::is_trivially_destructible_v<T> && std::is_trivially_copy_constructible_v<T>,
631 "List parameter type needs to be trivially constructable and trivially destructible!");
632
633 const auto count = value.size();
634 void *data = nullptr;
635 if (count) {
636 const auto asize = count * sizeof(T);
637 data = malloc(asize); // is freed in ~ListView
638 memcpy(data, value.constData(), asize);
639 }
640 auto prop = new Property;
641 prop->name = name;
642 prop->call = new PropertyListSetter(setter);
643 prop->value = QVariant::fromValue(new ListView{ QMetaType::fromType<rm_cvref_t<T>>(), data, count });
644 node.properties.push_back(prop);
645}
646
647
648Q_QUICK3DASSETUTILS_EXPORT QSSGSceneDesc::Property *setProperty(QSSGSceneDesc::Node &node, const char *name, QVariant &&value);
649
650// Calling this will omit any type checking, so make sure the type is handled correctly
651// when it gets used later!
652template<typename Setter>
653static void setProperty(QSSGSceneDesc::Node &node, const char *name, Setter setter, QVariant &&value)
654{
655 Q_ASSERT(node.scene);
656 Property *prop = new Property;
657 prop->name = name;
658 prop->call = new PropertySetter(setter);
659 prop->value = value;
660 node.properties.push_back(prop);
661}
662
663template<typename Setter, typename Value, if_compatible_proxy_t<Setter, Value> = true>
664static void setProperty(QSSGSceneDesc::Node &node, const char *name, Setter setter, Value &&value, QSSGSceneDesc::Property::Type type = QSSGSceneDesc::Property::Type::Static)
665{
666 Q_ASSERT(node.scene);
667 static_assert(std::is_trivially_destructible_v<rm_cvref_t<Value>>, "Value needs to be trivially destructible!");
668 Property *prop = new Property;
669 prop->name = name;
670 prop->call = new PropertyProxySetter(setter);
671 prop->value = QVariant::fromValue(value);
672 prop->type = type;
673 node.properties.push_back(prop);
674}
675
676template<typename Setter, typename ViewValue, if_compatible_t<Setter, typename ViewValue::type> = false>
677static void setProperty(QSSGSceneDesc::Node &node, const char *name, Setter setter, ViewValue view)
678{
679 Q_ASSERT(node.scene);
680 static_assert(std::is_same_v<typename ViewValue::type, typename FuncType<Setter>::Arg0Base>, "Type cannot be mapped to slot argument");
681 Property *prop = new Property;
682 prop->name = name;
683 prop->call = new PropertySetter(setter);
684 prop->value = QVariant::fromValue(view);
685 node.properties.push_back(prop);
686}
687
688template<typename Setter, typename Value, if_compatible_t<Setter, as_scene_type_t<Value> *> = true>
689static void setProperty(QSSGSceneDesc::Node &node, const char *name, Setter setter, Value *value)
690{
691 Q_ASSERT(node.scene);
692 Property *prop = new Property;
693 prop->name = name;
694 prop->call = new PropertySetter(setter);
695 // Always 'Node', the Node class itself contains more fine grain type information.
696 prop->value = QVariant::fromValue(static_cast<Node *>(value));
697 node.properties.push_back(prop);
698}
699
700// Overloaded function for setting a type to a property that's a QQmlListProperty.
701template<typename Setter, typename NodeT, qsizetype Prealloc, if_compatible_node_list_t<Setter, NodeT> = true>
702static void setProperty(QSSGSceneDesc::Node &node, const char *name, Setter setter, const QVarLengthArray<NodeT *, Prealloc> &list)
703{
704 Q_ASSERT(node.scene);
705 if (!list.isEmpty()) {
706 NodeList *l = new NodeList(reinterpret_cast<void * const*>(list.constData()), list.count());
707
708 Property *prop = new Property;
709 prop->name = name;
710 prop->call = new PropertyList(setter);
711 prop->value = QVariant::fromValue(l);
712 node.properties.push_back(prop);
713 }
714}
715
716} // QSSGSceneDesc
717
719
720Q_DECLARE_METATYPE(QSSGSceneDesc::Node)
721Q_DECLARE_METATYPE(QSSGSceneDesc::Texture)
722Q_DECLARE_METATYPE(QSSGSceneDesc::Material)
723Q_DECLARE_METATYPE(QSSGSceneDesc::Mesh)
724Q_DECLARE_METATYPE(QSSGSceneDesc::Model)
725Q_DECLARE_METATYPE(QSSGSceneDesc::Camera)
726Q_DECLARE_METATYPE(QSSGSceneDesc::Light)
727Q_DECLARE_METATYPE(QSSGSceneDesc::Skin)
728Q_DECLARE_METATYPE(QSSGSceneDesc::Skeleton)
729Q_DECLARE_METATYPE(QSSGSceneDesc::Joint)
730Q_DECLARE_METATYPE(QSSGSceneDesc::MorphTarget)
731Q_DECLARE_METATYPE(QSSGSceneDesc::NodeList)
732Q_DECLARE_METATYPE(QSSGSceneDesc::Animation)
733
734Q_DECLARE_METATYPE(QSSGSceneDesc::ListView)
735
736Q_DECLARE_METATYPE(QSSGSceneDesc::Flag)
737
738#endif // QSSGSCENEDESCRIPTION_P_H
bool isDefaultValue(QSSGSceneDesc::Node::RuntimeType type, const char *property, const QVariant &value)
PropertiesMap propertiesForType(QSSGSceneDesc::Node::RuntimeType type)
static PropertyMap * instance()
QVariant getDefaultValue(QSSGSceneDesc::Node::RuntimeType type, const char *property)
QHash< QByteArray, QVariant > PropertiesMap
The QVector2D class represents a vector or vertex in 2D space.
Definition qvectornd.h:34
The QVector3D class represents a vector or vertex in 3D space.
Definition qvectornd.h:178
The QVector4D class represents a vector or vertex in 4D space.
Definition qvectornd.h:341
static QString getInstancesFolder()
static const char * blockEnd()
static constexpr QByteArrayView qml_basic_types[]
QString builtinQmlType(const QVariant &var)
static void generateKeyframeData(const QSSGSceneDesc::Animation::Channel &channel, QByteArray &keyframeData)
void writeQmlComponent(const QSSGSceneDesc::Node &node, QTextStream &stream, const QDir &outDir)
static QString getIdForNode(const QSSGSceneDesc::Node &node)
QString asString(const QVariant &var)
static void writeNodeProperties(const QSSGSceneDesc::Node &node, OutputContext &output, const char *skipProperty=nullptr)
static QString getTextureFolder()
QString qmlComponentName(const QString &name)
static PropertyMap::PropertiesMap getObjectPropertiesMap(QObject *object)
static QString getAnimationFolder()
static QString getAnimationExtension()
static ValueToQmlResult valueToQml(const QSSGSceneDesc::Node &target, const QSSGSceneDesc::Property &property, OutputContext &output)
static QString outputInstanceTableAsset(const QSSGSceneDesc::Instancing &instancing, const QDir &outdir)
static void writeQml(const QSSGSceneDesc::Model &model, OutputContext &output)
QString colorToQml(const QColor &color)
void createTimelineAnimation(const QSSGSceneDesc::Animation &anim, QObject *parent, bool isEnabled, bool useBinaryKeyframes)
static QString getMeshExtension()
static const char * blockBegin()
static const char * blockBegin(OutputContext &output)
static void writeQml(const QSSGSceneDesc::Node &transform, OutputContext &output)
static QStringList expandComponents(const QString &value, QMetaType mt)
void writeQmlForResources(const QSSGSceneDesc::Scene::ResourceNodes &resources, OutputContext &output)
const char * qmlElementName()
QString sanitizeQmlId(const QString &id)
static QString toQmlStringLiteral(const QString &value)
static const char * blockEnd(OutputContext &output)
static QString outputTextureAsset(const QSSGSceneDesc::TextureData &textureData, const QDir &outdir)
static const char * comment()
static QTextStream & indent(OutputContext &output)
static QString toQuotedString(const QString &text)
static QString getIdForAnimation(const QByteArray &inName)
static QString getMeshFolder()
static void writeImportHeader(OutputContext &output, bool hasAnimation=false)
static QStringList expandComponentsPartially(const QString &value, QMetaType mt)
QPair< QString, QString > writeQmlForAnimation(const QSSGSceneDesc::Animation &anim, qsizetype index, OutputContext &output, bool useBinaryKeyframes=true, bool generateTimelineAnimations=true)
const char * getQmlElementName(const QSSGSceneDesc::Node &node)
static std::pair< QString, QString > copyTextureAsset(const QUrl &texturePath, OutputContext &output)
static std::pair< QString, QString > meshAssetName(const QSSGSceneDesc::Scene &scene, const QSSGSceneDesc::Mesh &meshNode, const QDir &outdir)
static const char * indent()
QString getAnimationSourceName(const QString &id, const QString &property, qsizetype index)
QString getMeshSourceName(const QString &name)
QString variantToQml(const QVariant &variant)
QString stripParentDirectory(const QString &filePath)
QString asString(QSSGSceneDesc::Animation::Channel::TargetProperty prop)
static void writeQmlForResourceNode(const QSSGSceneDesc::Node &node, OutputContext &output)
QString sanitizeQmlSourcePath(const QString &source, bool removeParentDirectory)
QString getTextureSourceName(const QString &name, const QString &fmt)
static void resetIdAllocator()
static QByteArrayView typeName(QMetaType mt)
void writeQml(const QSSGSceneDesc::Scene &scene, QTextStream &stream, const QDir &outdir, const QJsonObject &optionsObject)
static QString indentString(OutputContext &output)
void writeQml(const QSSGSceneDesc::Material &material, OutputContext &output)
static void writeQmlForNode(const QSSGSceneDesc::Node &node, OutputContext &output)
static void setProperty(QSSGSceneDesc::Node &node, const char *name, Setter setter, T &&value)
Q_QUICK3DASSETUTILS_EXPORT void addNode(Node &parent, Node &node)
static constexpr bool is_node_v
static void setProperty(QSSGSceneDesc::Node &node, const char *name, Setter setter, QFlags< T > value)
static void setProperty(QSSGSceneDesc::Node &node, const char *name, Setter setter, Value *value)
typename TypeMap< T >::type as_node_type_t
static void setProperty(QSSGSceneDesc::Node &node, const char *name, Setter setter, ViewValue view)
typename T::type as_scene_type_t
static void setProperty(QSSGSceneDesc::Node &node, const char *name, Setter setter, Value &&value, QSSGSceneDesc::Property::Type type=QSSGSceneDesc::Property::Type::Static)
static void setProperty(QSSGSceneDesc::Node &node, const char *name, Setter setter, QVariant &&value)
Q_QUICK3DASSETUTILS_EXPORT void destructNode(QSSGSceneDesc::Node &node)
static void setProperty(QSSGSceneDesc::Node &node, const char *name, Setter setter, const QVarLengthArray< NodeT *, Prealloc > &list)
Q_QUICK3DASSETUTILS_EXPORT void destructValue(QVariant &value)
Combined button and popup list for selecting options.
#define Q_DECLARE_METATYPE(TYPE)
Definition qmetatype.h:1521
#define QSSG_DECLARE_NODE(NODE)
NodeList(void *const *data, qsizetype n)
bool get(const QQuick3DObject &, const void *[]) const override
typename FuncType< Setter >::Arg0Base ListT
bool set(QQuick3DObject &that, const char *, const void *value) override
constexpr PropertyListSetter(Setter fn)
bool set(QQuick3DObject &that, const char *, const QVariant &var) override
void doSet(QQuick3DObject &that, const QSSGSceneDesc::NodeList &nodeList)
constexpr PropertyList(ListFunc fn)
bool set(QQuick3DObject &that, const char *, const QVariant &var) override
ListType(Class::*)() ListFunc
bool set(QQuick3DObject &that, const char *, const void *value) override
bool get(const QQuick3DObject &, const void *[]) const override
constexpr PropertyProxySetter(Setter fn)
Ret(*)(QQuick3DObject &, const char *, Arg) Setter
bool set(QQuick3DObject &that, const char *name, const QVariant &var) override
bool set(QQuick3DObject &that, const char *name, const void *value) override
bool get(const QQuick3DObject &, const void *[]) const override
bool set(QQuick3DObject &that, const char *, const QVariant &var) override
constexpr PropertySetter(Setter fn)
bool set(QQuick3DObject &that, const char *, const void *value) override
bool get(const QQuick3DObject &, const void *[]) const override
QSSGSceneDesc::PropertyCall * call