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

30 lines
921 B
C++
Raw Normal View History

2021-02-04 16:59:58 +08:00
#include <QDebug>
2021-04-02 20:47:15 +08:00
#include <QJsonObject>
2021-02-04 16:59:58 +08:00
#include "../shader/DoricRootNode.h"
#include "DoricShaderPlugin.h"
2021-04-02 20:47:15 +08:00
void DoricShaderPlugin::render(QJsonObject *jsValue, QString callbackId) {
2021-02-09 10:38:27 +08:00
getContext()->getDriver()->asyncCall(
[this, jsValue] {
try {
2021-04-02 20:47:15 +08:00
QString viewId = jsValue->value("id").toString();
DoricRootNode *rootNode = getContext()->getRootNode();
if (rootNode->getId().isEmpty() &&
2021-04-02 20:47:15 +08:00
jsValue->value("type").toString() == "Root") {
rootNode->setId(viewId);
2021-04-02 20:47:15 +08:00
rootNode->blend(jsValue->value("props"));
} else {
DoricViewNode *viewNode = getContext()->targetViewNode(viewId);
if (viewNode != nullptr) {
2021-04-02 20:47:15 +08:00
viewNode->blend(jsValue->value("props"));
}
}
} catch (...) {
qCritical() << "render exception";
}
2021-02-09 10:38:27 +08:00
},
DoricThreadMode::UI);
2021-02-04 16:59:58 +08:00
}