std::unique_ptr<NodeExecutor> NodeTree::createNodeExecutor(bool withInit) { if(_executeListDirty) prepareList(); return std::unique_ptr<NodeExecutor>(new NodeExecutorImpl{this, withInit}); }
QTodoLists::QTodoLists(QWidget* parent) : QListView(parent) { connect(this,SIGNAL(contextMenuRequested(QListViewItem * , const QPoint & , int )),this,SLOT(contextMenu(QListViewItem * , const QPoint & , int ))); connect(this,SIGNAL(selectionChanged()),this,SLOT(listChange())); connect(this,SIGNAL(listChanged()),this,SLOT(prepareList())); current = 0; }
void NodeTree::execute(bool withInit) { if(_executeListDirty) prepareList(); NodeSocketTracer tracer; NodeSocketReader reader(this, tracer); NodeSocketWriter writer(tracer); // Traverse through just-built exec list and process each node for(NodeID nodeID : _executeList) { Node& node = _nodes[nodeID]; tracer.setNode(nodeID); reader.setNode(nodeID, node.numInputSockets()); try { if(withInit && _nodes[nodeID].flag(ENodeFlags::StateNode)) { // Try to restart node internal state if any if(!node.restart()) { throw ExecutionError{node.nodeName(), nodeTypeName(nodeID), "Error during node state restart"}; } } ExecutionStatus ret = node.execute(reader, writer); switch (ret.status) { case EStatus::Tag: // Tag for next execution tagNode(nodeID); break; case EStatus::Error: // If node reported an error tagNode(nodeID); throw ExecutionError{node.nodeName(), nodeTypeName(nodeID), ret.message}; break; case EStatus::Ok: default: break; } } catch(...) { handleException(nodeID, tracer); } } _executeListDirty = true; }