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

Method loadSceneFromTree

bt_editor/graphic_container.cpp:647–670  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

645
646
647void GraphicContainer::loadSceneFromTree(const AbsBehaviorTree &tree)
648{
649 AbsBehaviorTree abs_tree = tree;
650 _scene->clearScene();
651
652 auto& first_qt_node = _scene->createNodeAtPos( "Root", "Root", QPointF(0,0) );
653
654 QPointF cursor( - first_qt_node.nodeGeometry().width()*0.5,
655 - first_qt_node.nodeGeometry().height()*0.5);
656
657 _scene->setNodePosition( first_qt_node, cursor );
658
659 auto root_node = abs_tree.rootNode();
660
661 if( root_node->model.registration_ID == "Root" )
662 {
663 root_node->graphic_node = &first_qt_node;
664 int root_child_index = root_node->children_index.front();
665 root_node = abs_tree.node(root_child_index);
666 }
667
668 recursiveLoadStep(cursor, abs_tree, root_node, &first_qt_node, 1 );
669 NodeReorder( *_scene, abs_tree );
670}
671
672void GraphicContainer::appendTreeToNode(Node &node, AbsBehaviorTree& subtree)
673{

Callers 1

Calls 5

NodeReorderFunction · 0.85
clearSceneMethod · 0.80
rootNodeMethod · 0.80
nodeMethod · 0.80
QPointFClass · 0.50

Tested by

no test coverage detected