MCPcopy Create free account
hub / github.com/BehaviorTree/Groot / getTreeNodeModel

Method getTreeNodeModel

bt_editor/custom_node_dialog.cpp:100–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98
99
100NodeModel CustomNodeDialog::getTreeNodeModel() const
101{
102 QString ID = ui->lineEdit->text();
103 NodeType type = NodeType::UNDEFINED;
104 PortModels ports;
105
106 switch( ui->comboBox->currentIndex() )
107 {
108 case 0: type = NodeType::ACTION; break;
109 case 1: type = NodeType::CONDITION; break;
110 case 2: type = NodeType::SUBTREE; break;
111 case 3: type = NodeType::DECORATOR; break;
112 }
113 for (int row=0; row < ui->tableWidget->rowCount(); row++ )
114 {
115 const QString key = ui->tableWidget->item(row,0)->text();
116 auto combo = static_cast<QComboBox*>(ui->tableWidget->cellWidget(row,1));
117 const QString direction = combo->currentText();
118
119 PortModel port_model;
120 port_model.direction = BT::convertFromString<PortDirection>(direction.toStdString());
121 port_model.default_value = ui->tableWidget->item(row,2)->text();
122 port_model.description = ui->tableWidget->item(row,3)->text();
123 ports.insert( {key, port_model} );
124 }
125 return { type, ID, ports };
126}
127
128
129void CustomNodeDialog::checkValid()

Callers 2

onContextMenuMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected