findNode static method

dynamic findNode(
  1. dynamic root,
  2. dynamic nodeName
)

Implementation

static findNode(root, nodeName) {
  if (nodeName == null ||
      nodeName == '' ||
      nodeName == '.' ||
      nodeName == -1 ||
      nodeName == root.name ||
      nodeName == root.uuid) {
    return root;
  }

  // search into skeleton bones.
  if (root.skeleton != null) {
    var bone = root.skeleton.getBoneByName(nodeName);

    if (bone != null) {
      return bone;
    }
  }

  // search into node subtree.
  if (root.children != null) {
    var subTreeNode = searchNodeSubtree(root.children, nodeName);

    if (subTreeNode != null) {
      return subTreeNode;
    }
  }

  return null;
}