getAllMatchingChildPrims#

Fully qualified name: isaacsim::foundation::utils::getAllMatchingChildPrims

std::vector<std::string> isaacsim::foundation::utils::getAllMatchingChildPrims(
const std::string &path,
std::function<bool(const std::string&)> predicate,
bool includeSelf = false,
std::optional<std::size_t> maxDepth = std::nullopt,
)#

Returns all prims in the subtree rooted at path for which predicate returns true.

Performs a breadth-first traversal of the default stage starting at path. Each visited prim is tested against predicate; those that pass are collected into the result.

When includeSelf is false the root prim itself is skipped and traversal begins with its direct children (depth 1). When includeSelf is true the root is enqueued at depth 0.

When maxDepth is set, traversal stops as soon as the current prim’s depth exceeds maxDepth. Because the deque is ordered by depth in BFS order, all remaining items at that point are at the same or greater depth, so the entire search halts immediately.

See also

getFirstMatchingChildPrim()

Parameters:
  • path – [in] USD path of the subtree root on the default stage.

  • predicate – [in] Callable invoked with the string path of each visited prim; return true to include the prim in the result.

  • includeSelf – [in] Whether to test and potentially include path itself.

  • maxDepth – [in] Maximum traversal depth relative to path, where path itself is at depth 0 and its direct children at depth 1. std::nullopt means unlimited depth. Note that depth is always counted from path regardless of includeSelf, so maxDepth=0 combined with includeSelf=false visits no prim at all: the direct children the traversal starts from are already at depth 1. Use maxDepth=1 to visit the direct children.

Returns:

All prim paths in BFS order for which predicate returned true.