6#include <QtGui/QGuiApplication>
8#include <QtCore/QVariant>
10#include <QtCore/QMetaProperty>
13#include <QtCore/QJsonObject>
14#include <QtCore/QJsonDocument>
15#include <QtCore/QJsonArray>
17#include <QtQuick3DAssetImport/private/qssgassetimportmanager_p.h>
18#include <QtQuick3DAssetUtils/private/qssgscenedesc_p.h>
19#include <QtQuick3DAssetUtils/private/qssgqmlutilities_p.h>
20#include <QtQuick3DAssetUtils/private/qssgrtutilities_p.h>
58 auto &val = prop->value;
59 if (qvariant_cast<QSSGSceneDesc::Node *>(val) == resource) {
63 if (val.metaType().id() == qMetaTypeId<QSSGSceneDesc::NodeList *>()) {
64 const auto &
list = *qvariant_cast<QSSGSceneDesc::NodeList *>(val);
66 if (
list.head[
i] == resource) {
67 list.head[
i] = replacement;
80 if (!root ||
name.isEmpty())
88 if (parent && !*parent)
100 for (
auto *resource :
scene->resources) {
101 if (resource->name ==
name && resource->nodeType == nodeType)
115 if (!excludeFunction || !excludeFunction(
child))
128 const auto end_it =
animation->channels.end();
129 auto remove_it = std::remove_if(
animation->channels.begin(), end_it, isTargeted);
130 for (
auto it = remove_it;
it != end_it; ++
it)
132 animation->channels.erase(remove_it, end_it);
140 for (
auto *
child : children)
149 auto it = std::find_if(propList->begin(), propList->end(), findName);
150 if (
it != propList->
end()) {
163 auto nodeName =
it.value().toString().toUtf8();
172 QVarLengthArray<QSSGSceneDesc::Node *> nodes;
174 for (
auto json :
array) {
177 qWarning() <<
"Could not find node for" << json;
198 if (
value.isArray()) {
200 }
else if (
value.isObject()) {
202 if (
obj.contains(u
"url")) {
203 auto path =
obj.value(u
"url").toString();
224 auto name = addition.value(u
"name").toString().toUtf8();
225 auto typeName = addition.value(u
"type").toString().toUtf8();
227 qWarning(
"Can't create node without name or type");
235 bool isSpecGlossy = addition.contains(u
"albedoColor") || addition.contains(u
"albedoMap")
236 || addition.contains(u
"glossinessMap") || addition.contains(u
"glossiness");
237 typeName = isSpecGlossy ?
"SpecularGlossyMaterial" :
"PrincipledMaterial";
240 if (
typeName ==
"PrincipledMaterial") {
242 QSSGRenderGraphObject::Type::PrincipledMaterial);
243 }
else if (
typeName ==
"SpecularGlossyMaterial") {
245 QSSGRenderGraphObject::Type::SpecularGlossyMaterial);
248 QSSGRenderGraphObject::Type::Image2D);
256 const auto &propertyName =
it.key();
257 if (propertyName == u
"name" || propertyName == u
"type" || propertyName == u
"comment" || propertyName == u
"command")
264 scene->resources.removeOne(prevResource);
277 auto command =
obj.value(u
"command").toString(u
"edit"_s);
279 if (command == u
"edit") {
285 const auto &propertyName =
it.key();
286 if (propertyName == u
"name" || propertyName == u
"type" || propertyName == u
"comment" || propertyName == u
"command")
291 }
else if (command == u
"add") {
293 }
else if (command == u
"delete") {
301 qWarning(
"Delete: could not find parent for node");
306 const auto editList = changes.
value(u
"editList").
toArray();
310 for (
auto edit : editList) {
312 if (
obj.value(u
"command") == u
"add"_s)
316 for (
auto edit : editList) {
318 if (
obj.value(u
"command") != u
"add"_s)
IOBluetoothL2CAPChannel * channel
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
QJsonValue value(const QString &key) const
Returns a QJsonValue representing the value for the key key.
\inmodule QtCore\reentrant
QJsonArray toArray() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool removeOne(const AT &t)
qsizetype count() const noexcept
const_iterator constBegin() const noexcept
const_iterator constEnd() const noexcept
iterator erase(const_iterator i)
QByteArray toUtf8() const
Returns a UTF-8 representation of the string view as a QByteArray.
static auto fromValue(T &&value) noexcept(std::is_nothrow_copy_constructible_v< T > &&Private::CanUseInternalSpace< T >) -> std::enable_if_t< std::conjunction_v< std::is_copy_constructible< T >, std::is_destructible< T > >, QVariant >
QSet< QString >::iterator it
static void removeFromAnimation(QSSGSceneDesc::Animation *animation, const NodeSet &nodes)
bool NodeFilter(QSSGSceneDesc::Node *)
void applyEdit(QSSGSceneDesc::Scene *scene, const QJsonObject &changes)
static QSSGSceneDesc::Node::Type nodeTypeFromName(const QByteArrayView &typeName)
static void removeProperty(QSSGSceneDesc::Node *node, const QByteArrayView &name)
static constexpr qsizetype nNodeTypes
static NodeSet flattenTree(QSSGSceneDesc::Node *node, NodeFilter *excludeFunction=nullptr)
static QSSGSceneDesc::NodeList * nodeListFromJson(const QSSGSceneDesc::Scene *scene, const QJsonArray &array)
static QSSGSceneDesc::Node * nodeFromJson(const QSSGSceneDesc::Scene *scene, const QJsonObject &nodeRef)
QSSGSceneDesc::Node * addResource(QSSGSceneDesc::Scene *scene, const QJsonObject &addition)
static void deleteTree(QSSGSceneDesc::Node *node)
static void replaceReferencesToResource(QSSGSceneDesc::Node *node, QSSGSceneDesc::Node *resource, QSSGSceneDesc::Node *replacement)
static const char * typeNames[]
static void unlinkChild(QSSGSceneDesc::Node *child, QSSGSceneDesc::Node *parent)
QSet< QSSGSceneDesc::Node * > NodeSet
static QSSGSceneDesc::Node * findResource(const QSSGSceneDesc::Scene *scene, const QByteArrayView &name, QSSGSceneDesc::Node::Type nodeType)
static QSSGSceneDesc::Node * findNode(QSSGSceneDesc::Node *root, const QByteArrayView name, QSSGSceneDesc::Node::Type type, QSSGSceneDesc::Node **parent=nullptr)
Q_QUICK3DASSETUTILS_EXPORT void applyPropertyValue(const QSSGSceneDesc::Node *node, QObject *obj, QSSGSceneDesc::Property *property)
static void setProperty(QSSGSceneDesc::Node &node, const char *name, Setter setter, T &&value)
Q_QUICK3DASSETUTILS_EXPORT void addNode(Node &parent, Node &node)
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLsizei const GLchar *const * path
args<< 1<< 2;QJSValue threeAgain=fun.call(args);QString fileName="helloworld.qs";QFile scriptFile(fileName);if(!scriptFile.open(QIODevice::ReadOnly)) QTextStream stream(&scriptFile);QString contents=stream.readAll();scriptFile.close();myEngine.evaluate(contents, fileName);myEngine.globalObject().setProperty("myNumber", 123);...QJSValue myNumberPlusOne=myEngine.evaluate("myNumber + 1");QJSValue result=myEngine.evaluate(...);if(result.isError()) qDebug()<< "Uncaught exception at line"<< result.property("lineNumber").toInt()<< ":"<< result.toString();QPushButton *button=new QPushButton;QJSValue scriptButton=myEngine.newQObject(button);myEngine.globalObject().setProperty("button", scriptButton);myEngine.evaluate("button.checkable = true");qDebug()<< scriptButton.property("checkable").toBool();scriptButton.property("show").call();QJSEngine engine;QObject *myQObject=new QObject();myQObject- setProperty)("dynamicProperty", 3)