34        auto ret = std::make_shared<QtDataModelRegistry>();
 
   36        for (
auto const c : *classMap)
 
   40            QString str = QString::fromStdString(c.first);
 
   42            std::shared_ptr<dyno::Node> node(
dynamic_cast<dyno::Node*
>(obj));
 
   46                QtDataModelRegistry::RegistryItemCreator creator = [str]() {
 
   48                    std::shared_ptr<dyno::Node> new_node(
dynamic_cast<dyno::Node*
>(node_obj));
 
   49                    auto dat = std::make_unique<QtNodeWidget>(std::move(new_node));
 
   58        this->setRegistry(ret);
 
   70        connect(
this, &QtFlowScene::nodeHotKeyClicked, [
this](QtNode& n, 
bool checked, 
int buttonId) {
 
 
  106        std::map<dyno::ObjectId, QtNode*> nodeMap;
 
  112        auto addNodeWidget = [&](std::shared_ptr<Node> m) -> 
void 
  114                auto mId = m->objectId();
 
  116                auto type = std::make_unique<QtNodeWidget>(m);
 
  118                auto& node = this->createNode(std::move(type));
 
  120                nodeMap[mId] = &node;
 
  122                QPointF posView(m->bx(), m->by());
 
  124            node.nodeGraphicsObject().setPos(posView);
 
  129        for (
auto it = scn->begin(); it != scn->end(); it++)
 
  131            addNodeWidget(it.get());
 
  134        auto createNodeConnections = [&](std::shared_ptr<Node> nd) -> 
void 
  136                auto inId = nd->objectId();
 
  138                if (nodeMap.find(inId) != nodeMap.end())
 
  140                    auto inBlock = nodeMap[nd->objectId()];
 
  142                    auto ports = nd->getImportNodes();
 
  144                    for (
int i = 0; i < ports.size(); i++)
 
  149                            auto node = ports[i]->getNodes()[0];
 
  152                                auto outId = node->objectId();
 
  153                                if (nodeMap.find(outId) != nodeMap.end())
 
  155                                    auto outBlock = nodeMap[node->objectId()];
 
  156                                    createConnection(*inBlock, i, *outBlock, 0);
 
  164                            auto& nodes = ports[i]->getNodes();
 
  166                            for (
int j = 0; j < nodes.size(); j++)
 
  168                                if (nodes[j] != 
nullptr)
 
  170                                    auto outId = nodes[j]->objectId();
 
  171                                    if (nodeMap.find(outId) != nodeMap.end())
 
  173                                        auto outBlock = nodeMap[outId];
 
  174                                        createConnection(*inBlock, i, *outBlock, 0);
 
  182                    auto fieldInp = nd->getInputFields();
 
  183                    for (
int i = 0; i < fieldInp.size(); i++)
 
  185                        std::vector<FBase*> validFields;
 
  186                        fieldInp[i]->requestValidSources(validFields);
 
  187                        for (
auto fieldSrc : validFields)
 
  189                            if (fieldSrc != 
nullptr) {
 
  190                                auto parSrc = fieldSrc->parent();
 
  191                                if (parSrc != 
nullptr)
 
  197                                    if (nodeSrc == 
nullptr)
 
  200                                        if (moduleSrc != 
nullptr)
 
  204                                    if (nodeSrc != 
nullptr)
 
  209                                        uint outFieldIndex = 0;
 
  210                                        bool fieldFound = 
false;
 
  211                                        for (
auto f : fieldsOut)
 
  221                                        if (nodeMap[outId]->nodeDataModel()->allowExported()) outFieldIndex++;
 
  223                                        if (fieldFound && nodeMap.find(outId) != nodeMap.end())
 
  225                                            auto outBlock = nodeMap[outId];
 
  226                                            createConnection(*inBlock, i + ports.size(), *outBlock, outFieldIndex);
 
  237        for (
auto it = scn->begin(); it != scn->end(); it++)
 
  239            createNodeConnections(it.get());
 
 
  298        std::cout << NodeName << std::endl;
 
  301        std::shared_ptr<dyno::Node> new_node(
dynamic_cast<dyno::Node*
>(node_obj));
 
  302        auto dat = std::make_unique<QtNodeWidget>(std::move(new_node));
 
  304        if (dat != 
nullptr) {
 
  306            scn->addNode(dat->getNode());
 
  309            std::cout << 
"nullptr" << std::endl;
 
  312        auto addNodeWidget = [&](std::shared_ptr<Node> m) -> 
void 
  316                auto type = std::make_unique<QtNodeWidget>(m);
 
  318                auto& node = this->createNode(std::move(type));
 
  320                QPointF posView(m->bx(), m->by());
 
  322                node.nodeGraphicsObject().setPos(posView);
 
  324                this->nodePlaced(node);
 
  328        for (
auto it = scn->begin(); it != scn->end(); it++)
 
  331                addNodeWidget(it.get());
 
  336        addNodeWidget(dat->getNode());
 
 
  388        auto qNodeWdiget = std::make_unique<QtNodeWidget>(node);
 
  389        auto& qNode = createNode(std::move(qNodeWdiget));
 
  392        auto& _nodes = this->nodes();
 
  394        for (
auto const& _node : _nodes)
 
  396            NodeGeometry& geo = _node.second->nodeGeometry();
 
  397            QtNodeGraphicsObject& obj = _node.second->nodeGraphicsObject();
 
  399            float h = geo.height();
 
  401            QPointF pos = obj.pos();
 
  403            y = std::max(y, 
float(pos.y() + h));
 
  406        QPointF posView(0.0f, y + 50.0f);
 
  408        qNode.nodeGraphicsObject().setPos(posView);
 
  410        emit nodePlaced(qNode);
 
 
  459        auto qDataModel = 
dynamic_cast<QtNodeWidget*
>(n.nodeDataModel());
 
  460        auto node = qDataModel->
getNode();
 
  461        if (node == 
nullptr) {
 
  465        auto menu = 
new QMenu;
 
  466        menu->setStyleSheet(
"QMenu{color:white;border: 1px solid black;} "); 
 
  468        auto openAct = 
new QAction(
"Open", 
this);
 
  470        auto showAllNodesAct = 
new QAction(
"Show All Nodes", 
this);
 
  471        auto showThisNodeOnlyAct = 
new QAction(
"Show This Only", 
this);
 
  473        showAllNodesAct->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_V));
 
  474        showThisNodeOnlyAct->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_H));
 
  476        auto delAct = 
new QAction(
"Delete", 
this);
 
  477        auto helpAct = 
new QAction(
"Help", 
this);
 
  479        menu->addAction(openAct);
 
  481        menu->addSeparator();
 
  482        menu->addAction(showThisNodeOnlyAct);
 
  483        menu->addAction(showAllNodesAct);
 
  486        auto resetNodeAct = 
new QAction(
"Reset This Node", 
this);
 
  487        auto activateThisNodeOnlyAct = 
new QAction(
"Activate This Only", 
this);
 
  488        auto activateAllNodesAct = 
new QAction(
"Activate All Nodes", 
this);
 
  489        menu->addSeparator();
 
  490        menu->addAction(resetNodeAct);
 
  492        menu->addSeparator();
 
  493        menu->addAction(activateThisNodeOnlyAct);
 
  494        menu->addAction(activateAllNodesAct);
 
  496        menu->addSeparator();
 
  497        auto autoSyncAct = 
new QAction(
"Auto-Sync", 
this);
 
  498        autoSyncAct->setCheckable(
true);
 
  499        autoSyncAct->setChecked(node->isAutoSync());
 
  501        auto enableDiscendants = 
new QAction(
"Enable Descendants' Auto-Sync(s)", 
this);
 
  502        auto disableDiscendants = 
new QAction(
"Disable Descendants' Auto-Sync(s)", 
this);
 
  503        auto enableAutoSync = 
new QAction(
"Enable All Auto-Sync(s)", 
this);
 
  504        auto disableAutoSync = 
new QAction(
"Disable All Auto-Sync(s)", 
this);
 
  505        menu->addAction(autoSyncAct);
 
  506        menu->addAction(enableDiscendants);
 
  507        menu->addAction(disableDiscendants);
 
  509        menu->addAction(disableAutoSync);
 
  511        menu->addSeparator();
 
  512        menu->addAction(delAct);
 
  514        menu->addSeparator();
 
  515        menu->addAction(helpAct);
 
  517        connect(openAct, &QAction::triggered, 
this, [&]() { nodeDoubleClicked(n); });
 
  520        connect(showAllNodesAct, &QAction::triggered, 
this, [&]() {
 
  524        connect(showThisNodeOnlyAct, &QAction::triggered, 
this, [&]() {
 
  528        connect(resetNodeAct, &QAction::triggered, 
this, [&]() {
 
  532        connect(activateAllNodesAct, &QAction::triggered, 
this, [&]() {
 
  536        connect(activateThisNodeOnlyAct, &QAction::triggered, 
this, [&]() {
 
  540        connect(autoSyncAct, &QAction::triggered, 
this, [=](
bool checked) {
 
  541            node->setAutoSync(checked);
 
  544        connect(enableDiscendants, &QAction::triggered, 
this, [&]() {
 
  548        connect(disableDiscendants, &QAction::triggered, 
this, [&]() {
 
  556        connect(disableAutoSync, &QAction::triggered, 
this, [=]() {
 
  560        connect(delAct, &QAction::triggered, 
this, [&]() { this->removeNode(n); });
 
  561        connect(helpAct, &QAction::triggered, 
this, [&]() { this->
showHelper(n); });
 
  563        menu->move(QCursor().pos().x() + 4, QCursor().pos().y() + 4);
 
 
  694        auto constructDAG = [&](std::shared_ptr<Node> nd) -> 
void 
  697                auto inId = nd->objectId();
 
  699                auto ports = nd->getImportNodes();
 
  704                bool NodeConnection = 
false;
 
  705                bool FieldConnection = 
false;
 
  706                for (
int i = 0; i < ports.size(); i++)
 
  711                        auto node = ports[i]->getNodes()[0];
 
  714                            auto outId = node->objectId();
 
  723                        auto& nodes = ports[i]->getNodes();
 
  724                        for (
int j = 0; j < nodes.size(); j++)
 
  726                            if (nodes[j] != 
nullptr)
 
  728                                auto outId = nodes[j]->objectId();
 
  741                auto fieldInp = nd->getInputFields();
 
  742                for (
int i = 0; i < fieldInp.size(); i++)
 
  744                    std::vector<FBase*> validFields;
 
  745                    fieldInp[i]->requestValidSources(validFields);
 
  746                    for (
auto fieldSrc : validFields)
 
  748                        if (fieldSrc != 
nullptr) {
 
  749                            auto parSrc = fieldSrc->parent();
 
  750                            if (parSrc != 
nullptr)
 
  752                                Node* nodeSrc = 
dynamic_cast<Node*
>(parSrc);
 
  755                                if (nodeSrc == 
nullptr)
 
  758                                    if (moduleSrc != 
nullptr)
 
  762                                if (nodeSrc != 
nullptr)
 
  776        for (
auto it = scn->begin(); it != scn->end(); it++)
 
  778            constructDAG(it.get());
 
  786        auto& _nodes = this->nodes();
 
  787        std::map<dyno::ObjectId, QtNode*> qtNodeMapper;
 
  788        std::map<dyno::ObjectId, Node*> nodeMapper;
 
  789        for (
auto const& _node : _nodes)
 
  791            auto const& qtNode = _node.second;
 
  792            auto model = qtNode->nodeDataModel();
 
  796            if (model != 
nullptr)
 
  798                auto node = nodeData->getNode();
 
  801                    qtNodeMapper[node->objectId()] = qtNode.get();
 
  802                    nodeMapper[node->objectId()] = node.get();
 
  806        float tempOffsetY = 0.0f;
 
  808        float offsetX = 0.0f;
 
  811            auto& xc = layout.
layer(l);
 
  813            float offsetY = 0.0f;
 
  815            for (
size_t index = 0; index < xc.size(); index++)
 
  818                if (qtNodeMapper.find(
id) != qtNodeMapper.end())
 
  820                    QtNode* qtNode = qtNodeMapper[id];
 
  821                    NodeGeometry& geo = qtNode->nodeGeometry();
 
  823                    float w = geo.width();
 
  824                    float h = geo.height();
 
  826                    xMax = std::max(xMax, w);
 
  828                    Node* node = nodeMapper[id];
 
  832                    offsetY += (h + 
mDy);
 
  837            offsetX += (xMax + 
mDx);
 
  839            tempOffsetY = std::max(tempOffsetY, offsetY);
 
  849        std::set<dyno::ObjectId>::iterator it;
 
  851        float ofstY = tempOffsetY;
 
  853        for (it = otherVertices.begin(); it != otherVertices.end(); it++)
 
  856            if (qtNodeMapper.find(
id) != qtNodeMapper.end())
 
  858                QtNode* qtNode = qtNodeMapper[id];
 
  859                NodeGeometry& geo = qtNode->nodeGeometry();
 
  861                heigth = geo.height();
 
  863                Node* node = nodeMapper[id];
 
  867                ofstX += width + 
mDx;
 
  874        qtNodeMapper.clear();