This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
Doric/doric-Qt/doric/plugin/DoricShaderPlugin.cpp
2021-05-20 18:27:45 +08:00

30 lines
921 B
C++

#include <QDebug>
#include <QJsonObject>
#include "../shader/DoricRootNode.h"
#include "DoricShaderPlugin.h"
void DoricShaderPlugin::render(QJsonObject *jsValue, QString callbackId) {
getContext()->getDriver()->asyncCall(
[this, jsValue] {
try {
QString viewId = jsValue->value("id").toString();
DoricRootNode *rootNode = getContext()->getRootNode();
if (rootNode->getId().isEmpty() &&
jsValue->value("type").toString() == "Root") {
rootNode->setId(viewId);
rootNode->blend(jsValue->value("props"));
} else {
DoricViewNode *viewNode = getContext()->targetViewNode(viewId);
if (viewNode != nullptr) {
viewNode->blend(jsValue->value("props"));
}
}
} catch (...) {
qCritical() << "render exception";
}
},
DoricThreadMode::UI);
}