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

Method appendTreeToNode

bt_editor/graphic_container.cpp:672–702  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

670}
671
672void 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
704void GraphicContainer::loadFromJson(const QByteArray &data)
705{

Callers 1

subTreeExpandMethod · 0.80

Calls 3

rootNodeMethod · 0.80
nodeMethod · 0.80
QPointFClass · 0.50

Tested by

no test coverage detected