Skip to content

GetFullPath only return the node name #1114

@pectum83

Description

@pectum83

Calling fullPath of a TreeNode return only its node name without the full path

/// Human readable identifier, that includes the hierarchy of Subtrees
  /// See tutorial 10 as an example.
  [[nodiscard]] const std::string& fullPath() const;

To solve the problem I modified BehaviorTree.CPP/src/xml_parsing.cpp

  • add child_prefix
  • replace prefix by child_prefix in recursiveStep call arg
  // common case: iterate through all children
    if(node->type() != NodeType::SUBTREE)
    {
      std::string child_prefix = prefix;
      if(!node->name().empty())
      {
        child_prefix += node->name();
        child_prefix += "/";
      }
      for(auto child_element = element->FirstChildElement(); child_element != nullptr;
          child_element = child_element->NextSiblingElement())
      {
        recursiveStep(node, subtree, child_prefix, child_element);
      }
    }
    else  // special case: SubTreeNode
    { ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions