| 670 | } |
| 671 | |
| 672 | void GraphicContainer::appendTreeToNode(Node &node, AbsBehaviorTree& subtree) |
| 673 | { |
| 674 | const QSignalBlocker blocker( this ); |
| 675 | |
| 676 | for (auto& abs_node: subtree.nodes() ) |
| 677 | { |
| 678 | abs_node.graphic_node = nullptr; |
| 679 | } |
| 680 | |
| 681 | //-------------------------------------- |
| 682 | QPointF cursor = _scene->getNodePosition(node) + QPointF(100,100); |
| 683 | |
| 684 | auto root_node = subtree.rootNode(); |
| 685 | |
| 686 | if( root_node->model.registration_ID == "Root" ) |
| 687 | { |
| 688 | if( root_node->children_index.size() == 1) |
| 689 | { |
| 690 | // first node become the child of Root |
| 691 | int root_child_index = root_node->children_index.front(); |
| 692 | root_node = subtree.node(root_child_index); |
| 693 | } |
| 694 | else{ |
| 695 | // Root has no child. Stop |
| 696 | // qDebug() << "Error: can't expand empty subtree"; |
| 697 | return; |
| 698 | } |
| 699 | } |
| 700 | |
| 701 | recursiveLoadStep(cursor, subtree, root_node , &node, 1 ); |
| 702 | } |
| 703 | |
| 704 | void GraphicContainer::loadFromJson(const QByteArray &data) |
| 705 | { |
no test coverage detected