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
44#include <qmetatype.h>
45#include <QtQuick3DUtils/private/qssginvasivelinkedlist_p.h>
46
47#include <QtGui/qquaternion.h>
48
50
51//
52// W A R N I N G
53// -------------
54//
55// This file is not part of the Qt API. It exists purely as an
56// implementation detail. This header file may change from version to
57// version without notice, or even be removed.
58//
59// We mean it.
60//
61
62namespace QSSGSceneDesc
63{
64
65struct Node;
66struct Animation;
67
68template<typename T>
70
71struct Q_QUICK3DASSETUTILS_EXPORT Scene
72{
76
77 // Root node, usually an empty 'transform' node.
78 Node *root = nullptr;
79 QString id; // Don't make any assumption about the content of this id...
84 mutable quint16 nodeId = 0;
85
86 void reset();
87 void cleanup();
88};
89
90struct Q_QUICK3DASSETUTILS_EXPORT PropertyCall
91{
92 virtual ~PropertyCall() = default;
93 virtual bool set(QQuick3DObject &, const char *, const void *) = 0;
94 virtual bool set(QQuick3DObject &, const char *, const QVariant &) = 0;
95 virtual bool get(const QQuick3DObject &, const void *[]) const = 0;
96};
97
98Q_QUICK3DASSETUTILS_EXPORT void destructValue(QVariant &value);
99
100struct Flag
101{
103 int value;
104};
105
107{
108 ~Property();
109 enum class Type { Static, Dynamic };
110 QVariant value;
114};
115
117{
118 delete call;
119 destructValue(value);
120}
121
122Q_QUICK3DASSETUTILS_EXPORT void destructNode(QSSGSceneDesc::Node &node);
123
125{
126 NodeList(void * const *data, qsizetype n)
127 {
128 const auto size = sizeof(Node *) * n;
129 head = reinterpret_cast<Node **>(malloc(size));
130 memcpy(head, data, size);
131 count = n;
132 }
133 ~NodeList() { if (head) free(head); }
134 Node **head = nullptr;
136};
137
138struct Q_QUICK3DASSETUTILS_EXPORT Node
139{
140 // Node type
155
157 // Runtime type type mapping between this type and the QtQuick3D type
159
165 : Node(nullptr, type, rt) {}
166
167 virtual ~Node();
168 void cleanupChildren();
169
171 Scene *scene = nullptr;
172 QObject *obj = nullptr;
173 using ChildList = QList<Node *>;
180};
181
182template<typename T>
183static constexpr bool is_node_v = std::is_base_of_v<Node, T>;
184
185// Set up type mapping from a QQuick3D type to a SceneDesc type
186template <typename T> struct TypeMap {};
187#define QSSG_DECLARE_NODE(NODE) static_assert
188 (is_node_v<NODE>, #NODE " - does not inherit from Node!"); template
189 <> struct TypeMap<NODE::type> { using type = QSSGSceneDesc::NODE; };
190
191template<typename T>
192using as_scene_type_t = typename T::type;
193template<typename T>
194using as_node_type_t = typename TypeMap<T>::type;
195
197
198struct Q_QUICK3DASSETUTILS_EXPORT Texture : Node
199{
201 explicit Texture(Node::RuntimeType rt, const QByteArray &name = {});
202};
204
205struct Q_QUICK3DASSETUTILS_EXPORT TextureData : Node
206{
208 enum class Flags : quint8
209 {
211 };
212
218};
220
221struct Q_QUICK3DASSETUTILS_EXPORT Material : Node
222{
224 explicit Material(Node::RuntimeType rt);
225};
227
228// The mesh is a special node, as it's not really a node type but
229// a handle to a mesh that will be turned into a source URL...
230struct Q_QUICK3DASSETUTILS_EXPORT Mesh : Node
231{
233 qsizetype idx; // idx to the mesh data in the mesh data storage (see Scene).
234};
235
236struct Q_QUICK3DASSETUTILS_EXPORT Model : Node
237{
239 Model();
240};
242
243struct Q_QUICK3DASSETUTILS_EXPORT Camera : Node
244{
246 explicit Camera(RuntimeType rt);
247};
249
250struct Q_QUICK3DASSETUTILS_EXPORT Light : Node
251{
253 explicit Light(RuntimeType rt);
254};
256
257struct Q_QUICK3DASSETUTILS_EXPORT Skin : Node
258{
260 Skin();
261};
263
264struct Q_QUICK3DASSETUTILS_EXPORT Skeleton : Node
265{
267 Skeleton();
268 // Skeleton is a virtual node, which is added for the start of the joint heirarchy.
269 // parent - joint 1 -> parent - skeleton - joint 1
270 // - joint 2 - joint 2
271 // - model 1 - model 1
272 // - camera 1 - camera 1
274};
276
277struct Q_QUICK3DASSETUTILS_EXPORT Joint : Node
278{
280 Joint();
281};
283
284struct Q_QUICK3DASSETUTILS_EXPORT MorphTarget : Node
285{
287 MorphTarget();
288};
290
291// We keep our own list data structure, since Qt does not have a variant list where all the
292// elements have the same type, and using a list of QVariant is very inefficient
294{
295 ~ListView() { if (data) free(data); }
297 void *data = nullptr;
299};
300
301Q_QUICK3DASSETUTILS_EXPORT QMetaType listViewMetaType();
302
304{
306 {
307 enum class KeyType : quint16
308 {
309 Frame = 0x100,
310 Time = 0x200
311 };
312
321
322 ValueType getValueType() const { return ValueType(0xf & flag); }
323 KeyType getKeyType() const { return KeyType(0xf00 & flag); }
324 QVariant getValue() const {
325 switch (getValueType()) {
326 case ValueType::Number:
327 return value.x();
328 case ValueType::Vec2:
329 return value.toVector2D();
330 case ValueType::Vec3:
331 return value.toVector3D();
332 case ValueType::Vec4:
333 return value;
334 case ValueType::Quaternion:
335 return QQuaternion(value);
336 }
337 return value;
338 }
340 switch (getValueType()) {
341 case ValueType::Number:
342 return QMetaType::Float;
343 case ValueType::Vec2:
344 return QMetaType::QVector2D;
345 case ValueType::Vec3:
346 return QMetaType::QVector3D;
347 case ValueType::Vec4:
348 return QMetaType::QVector4D;
349 case ValueType::Quaternion:
350 return QMetaType::QQuaternion;
351 }
352 return QMetaType::QVector4D;
353 }
355 float time = 0.0f;
357 };
359
360 struct Channel
361 {
362 enum class TargetType : quint8
363 {
365 };
366
367 // This is a bit simplistic, but is all we support so let's keep simple.
369 {
374 Weight // for MorphMesh
375 };
376
377 Node *target = nullptr;
381 };
383
385 // It stores the length of this Animation, every keys in every channels in
386 // an animation will have the same KeyType and it will be a type of
387 // the length
388 float length = 0.0f;
389
390 float framesPerSecond = 0.0f; // for translation back to frames
391
393};
394
395// Add a child node to parent node.
396Q_QUICK3DASSETUTILS_EXPORT void addNode(Node &parent, Node &node);
397// Add node to the scene, if a node is already set the new node will
398// become a child of the root node.
399Q_QUICK3DASSETUTILS_EXPORT void addNode(Scene &scene, Node &node);
400
401template<typename> struct ListParam { enum { value = 0 }; };
402template<typename T> struct ListParam<QList<T>>
403{
404 using type = T;
405 enum { value = 1 };
406};
407
408template <typename T>
410
411template <typename T>
413{
414 enum { value = 0 };
415};
416
417template <typename R, typename... A>
418struct FuncType<R (*)(A...)>
419{
420 enum { value = sizeof...(A) == 3 };
421 using Ret = R;
422 using Arg0 = std::tuple_element_t<0, std::tuple<A...>>;
423 using Arg1 = std::tuple_element_t<1, std::tuple<A...>>;
424 using Arg2 = std::tuple_element_t<2, std::tuple<A...>>;
426};
427
428template <typename R, typename C, typename... A>
429struct FuncType<R (C::*)(A...)>
430{
431 enum { value = sizeof... (A) == 1 };
432 using Ret = R;
433 using Class = C;
434 // For now we only care about single argument functions
435 using Arg0 = std::tuple_element_t<0, std::tuple<A...>>;
437};
438
439template <typename T, typename C>
441{
442 enum { value = 2 };
444 using Class = C;
445 using Arg0 = void;
446 using Arg0Base = Arg0;
447};
448
449template <typename Ret, typename Arg>
451{
452 using Setter = Ret (*)(QQuick3DObject &, const char *, Arg);
453 constexpr explicit PropertyProxySetter(Setter fn) : call(fn) {}
454 Setter call = nullptr;
455 bool get(const QQuick3DObject &, const void *[]) const override { return false; }
456 bool set(QQuick3DObject &that, const char *name, const void *value) override
457 {
458 if constexpr (std::is_pointer_v<typename FuncType<Setter>::Arg2>)
459 call(that, name, reinterpret_cast<typename FuncType<Setter>::Arg2>(const_cast<void *>(value)));
460 else
461 call(that, name, *reinterpret_cast<typename FuncType<Setter>::Arg2Base *>(const_cast<void *>(value)));
462 return true;
463 }
464 bool set(QQuick3DObject &that, const char *name, const QVariant &var) override
465 {
466 call(that, name, qvariant_cast<typename FuncType<Setter>::Arg2Base>(var));
467 return true;
468 }
469};
470
471template <typename Ret, typename Class, typename Arg>
473{
474 using Setter = Ret (Class::*)(Arg);
475 constexpr explicit PropertySetter(Setter fn) : call(fn) {}
476 Setter call = nullptr;
477 bool get(const QQuick3DObject &, const void *[]) const override { return false; }
478 bool set(QQuick3DObject &that, const char *, const void *value) override
479 {
480 if constexpr (std::is_pointer_v<typename FuncType<Setter>::Arg0>)
481 (qobject_cast<Class *>(&that)->*call)(reinterpret_cast<typename FuncType<Setter>::Arg0>(const_cast<void *>(value)));
482 else {
483 (qobject_cast<Class *>(&that)->*call)(*reinterpret_cast<typename FuncType<Setter>::Arg0Base *>(const_cast<void *>(value)));
484 }
485 return true;
486 }
487 bool set(QQuick3DObject &that, const char *, const QVariant &var) override
488 {
489 (qobject_cast<Class *>(&that)->*call)(qvariant_cast<typename FuncType<Setter>::Arg0Base>(var));
490 return true;
491 }
492};
493
494template <typename Ret, typename Class, typename Arg>
496{
497 using Setter = Ret (Class::*)(Arg);
498 using ListT = typename FuncType<Setter>::Arg0Base;
500 constexpr explicit PropertyListSetter(Setter fn) : call(fn) {}
501 Setter call = nullptr;
502 bool get(const QQuick3DObject &, const void *[]) const override { return false; }
503 bool set(QQuick3DObject &that, const char *, const void *value) override
504 {
505 if (const auto listView = reinterpret_cast<const ListView *>(value)) {
506 if (listView->count > 0) {
507 const auto begin = reinterpret_cast<It *>(listView->data);
508 const auto end = reinterpret_cast<It *>(listView->data) + listView->count;
509 (qobject_cast<Class *>(&that)->*call)(ListT{begin, end});
510 } else {
511 (qobject_cast<Class *>(&that)->*call)(ListT{});
512 }
513 return true;
514 }
515
516 return false;
517 }
518 bool set(QQuick3DObject &that, const char *, const QVariant &var) override
519 {
520 if (const auto listView = qvariant_cast<const ListView *>(var)) {
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 }
529 return false;
530 }
531};
532
533template <typename Class, typename T, template <typename> typename List>
535{
536 using ListType = List<T>;
537 using ListFunc = ListType (Class::*)();
538 constexpr explicit PropertyList(ListFunc fn) : listfn(fn) {}
539 ListFunc listfn = nullptr;
540
541 static_assert(std::is_same_v<ListType, QQmlListProperty<T>>, "Expected QQmlListProperty!");
542
543 bool get(const QQuick3DObject &, const void *[]) const override { return false; }
544
545
546 void doSet(QQuick3DObject &that, const QSSGSceneDesc::NodeList &nodeList)
547 {
548 ListType list = (qobject_cast<Class *>(&that)->*listfn)();
549 auto head = reinterpret_cast<as_node_type_t<T> **>(nodeList.head);
550 for (int i = 0, end = nodeList.count; i != end; ++i)
551 list.append(&list, qobject_cast<T *>((*(head + i))->obj));
552 }
553
554 bool set(QQuick3DObject &that, const char *, const void *value) override
555 {
556 if (value) {
557 const auto &nodeList = *reinterpret_cast<const QSSGSceneDesc::NodeList *>(value);
558 doSet(that, nodeList);
559 return true;
560 }
561 return false;
562 }
563
564 bool set(QQuick3DObject &that, const char *, const QVariant &var) override
565 {
566 const auto *nodeList = qvariant_cast<const QSSGSceneDesc::NodeList *>(var);
567 if (nodeList) {
568 doSet(that, *nodeList);
569 return true;
570 }
571 return false;
572 }
573};
574
575template <typename NodeT>
576using if_node = typename std::enable_if_t<is_node_v<NodeT>, bool>;
577template <typename Setter, typename Value>
579template <typename Setter, typename T>
581template <typename Setter, typename Value>
583
584// Sets a property on a node, the property is a name map to struct containing a pointer to the value and a function
585// to set the value on an runtime object (QtQuick3DObject). The type is verified at compile-time, so we can assume
586// the value is of the right type when setting it at run-time.
587template<typename Setter, typename T, if_compatible_t<Setter, T> = false>
588static void setProperty(QSSGSceneDesc::Node &node, const char *name, Setter setter, T &&value)
589{
590 Q_ASSERT(node.scene);
591 auto prop = new Property;
592 prop->name = name;
593 prop->call = new PropertySetter(setter);
594 prop->value = QVariant::fromValue(std::forward<T>(value));
595 node.properties.push_back(prop);
596}
597
598template<typename Setter, typename T, if_compatible_t<Setter, QFlags<T>> = false>
599static void setProperty(QSSGSceneDesc::Node &node, const char *name, Setter setter, QFlags<T> value)
600{
601 Q_ASSERT(node.scene);
602 auto prop = new Property;
603 prop->name = name;
604 prop->call = new PropertySetter(setter);
605 prop->value = QVariant::fromValue(Flag{ QMetaEnum::fromType<rm_cvref_t<T>>(), value.toInt() });
606 node.properties.push_back(prop);
607}
608
609
610template<typename Setter, typename T, if_compatible_t<Setter, QList<T>> = false>
611static void setProperty(QSSGSceneDesc::Node &node, const char *name, Setter setter, QList<T> value)
612{
613 Q_ASSERT(node.scene);
614 static_assert(!std::is_pointer_v<T>, "Type cannot be a pointer!");
615 static_assert(std::is_trivially_destructible_v<T> && std::is_trivially_copy_constructible_v<T>,
616 "List parameter type needs to be trivially constructable and trivially destructible!");
617
618 const auto count = value.size();
619 void *data = nullptr;
620 if (count) {
621 const auto asize = count * sizeof(T);
622 data = malloc(asize); // is freed in ~ListView
623 memcpy(data, value.constData(), asize);
624 }
625 auto prop = new Property;
626 prop->name = name;
627 prop->call = new PropertyListSetter(setter);
628 prop->value = QVariant::fromValue(new ListView{ QMetaType::fromType<rm_cvref_t<T>>(), data, count });
629 node.properties.push_back(prop);
630}
631
632
633Q_QUICK3DASSETUTILS_EXPORT QSSGSceneDesc::Property *setProperty(QSSGSceneDesc::Node &node, const char *name, QVariant &&value);
634
635// Calling this will omit any type checking, so make sure the type is handled correctly
636// when it gets used later!
637template<typename Setter>
638static void setProperty(QSSGSceneDesc::Node &node, const char *name, Setter setter, QVariant &&value)
639{
640 Q_ASSERT(node.scene);
641 Property *prop = new Property;
642 prop->name = name;
643 prop->call = new PropertySetter(setter);
644 prop->value = value;
645 node.properties.push_back(prop);
646}
647
648template<typename Setter, typename Value, if_compatible_proxy_t<Setter, Value> = true>
649static void setProperty(QSSGSceneDesc::Node &node, const char *name, Setter setter, Value &&value, QSSGSceneDesc::Property::Type type = QSSGSceneDesc::Property::Type::Static)
650{
651 Q_ASSERT(node.scene);
652 static_assert(std::is_trivially_destructible_v<rm_cvref_t<Value>>, "Value needs to be trivially destructible!");
653 Property *prop = new Property;
654 prop->name = name;
655 prop->call = new PropertyProxySetter(setter);
656 prop->value = QVariant::fromValue(value);
657 prop->type = type;
658 node.properties.push_back(prop);
659}
660
661template<typename Setter, typename ViewValue, if_compatible_t<Setter, typename ViewValue::type> = false>
662static void setProperty(QSSGSceneDesc::Node &node, const char *name, Setter setter, ViewValue view)
663{
664 Q_ASSERT(node.scene);
665 static_assert(std::is_same_v<typename ViewValue::type, typename FuncType<Setter>::Arg0Base>, "Type cannot be mapped to slot argument");
666 Property *prop = new Property;
667 prop->name = name;
668 prop->call = new PropertySetter(setter);
669 prop->value = QVariant::fromValue(view);
670 node.properties.push_back(prop);
671}
672
673template<typename Setter, typename Value, if_compatible_t<Setter, as_scene_type_t<Value> *> = true>
674static void setProperty(QSSGSceneDesc::Node &node, const char *name, Setter setter, Value *value)
675{
676 Q_ASSERT(node.scene);
677 Property *prop = new Property;
678 prop->name = name;
679 prop->call = new PropertySetter(setter);
680 // Always 'Node', the Node class itself contains more fine grain type information.
681 prop->value = QVariant::fromValue(static_cast<Node *>(value));
682 node.properties.push_back(prop);
683}
684
685// Overloaded function for setting a type to a property that's a QQmlListProperty.
686template<typename Setter, typename NodeT, qsizetype Prealloc, if_compatible_node_list_t<Setter, NodeT> = true>
687static void setProperty(QSSGSceneDesc::Node &node, const char *name, Setter setter, const QVarLengthArray<NodeT *, Prealloc> &list)
688{
689 Q_ASSERT(node.scene);
690 if (!list.isEmpty()) {
691 NodeList *l = new NodeList(reinterpret_cast<void * const*>(list.constData()), list.count());
692
693 Property *prop = new Property;
694 prop->name = name;
695 prop->call = new PropertyList(setter);
696 prop->value = QVariant::fromValue(l);
697 node.properties.push_back(prop);
698 }
699}
700
701} // QSSGSceneDesc
702
704
705Q_DECLARE_METATYPE(QSSGSceneDesc::Node)
706Q_DECLARE_METATYPE(QSSGSceneDesc::Texture)
707Q_DECLARE_METATYPE(QSSGSceneDesc::Material)
708Q_DECLARE_METATYPE(QSSGSceneDesc::Mesh)
709Q_DECLARE_METATYPE(QSSGSceneDesc::Model)
710Q_DECLARE_METATYPE(QSSGSceneDesc::Camera)
711Q_DECLARE_METATYPE(QSSGSceneDesc::Light)
712Q_DECLARE_METATYPE(QSSGSceneDesc::Skin)
713Q_DECLARE_METATYPE(QSSGSceneDesc::Skeleton)
714Q_DECLARE_METATYPE(QSSGSceneDesc::Joint)
715Q_DECLARE_METATYPE(QSSGSceneDesc::MorphTarget)
716Q_DECLARE_METATYPE(QSSGSceneDesc::NodeList)
717Q_DECLARE_METATYPE(QSSGSceneDesc::Animation)
718
719Q_DECLARE_METATYPE(QSSGSceneDesc::ListView)
720
721Q_DECLARE_METATYPE(QSSGSceneDesc::Flag)
722
723#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:31
The QVector3D class represents a vector or vertex in 3D space.
Definition qvectornd.h:171
The QVector4D class represents a vector or vertex in 4D space.
Definition qvectornd.h:330
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 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 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 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)
static void writeNodeProperties(const QSSGSceneDesc::Node &node, OutputContext &output)
QPair< QString, QString > writeQmlForAnimation(const QSSGSceneDesc::Animation &anim, qsizetype index, OutputContext &output, bool useBinaryKeyframes=true, bool generateTimelineAnimations=true)
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 * getQmlElementName(const QSSGSceneDesc::Node &node)
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 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:1507
#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