| 759 | |
| 760 | |
| 761 | void MainWindow::onAddToModelRegistry(const NodeModel &model) |
| 762 | { |
| 763 | namespace util = QtNodes::detail; |
| 764 | const auto& ID = model.registration_ID; |
| 765 | |
| 766 | DataModelRegistry::RegistryItemCreator node_creator = [model]() -> DataModelRegistry::RegistryItemPtr |
| 767 | { |
| 768 | if( model.type == NodeType::SUBTREE) |
| 769 | { |
| 770 | return util::make_unique<SubtreeNodeModel>(model); |
| 771 | } |
| 772 | return util::make_unique<BehaviorTreeDataModel>(model); |
| 773 | }; |
| 774 | |
| 775 | _model_registry->registerModel( QString::fromStdString( toStr(model.type)), node_creator, ID); |
| 776 | |
| 777 | if( model.type == NodeType::SUBTREE && getTabByName(model.registration_ID) == nullptr) |
| 778 | { |
| 779 | createTab(model.registration_ID); |
| 780 | } |
| 781 | |
| 782 | _treenode_models.insert( {ID, model } ); |
| 783 | _editor_widget->updateTreeView(); |
| 784 | } |
| 785 | |
| 786 | void MainWindow::onDestroySubTree(const QString &ID) |
| 787 | { |
nothing calls this directly
no test coverage detected