getFirstMatchingParentPrim#
Fully qualified name: isaacsim::foundation::utils::getFirstMatchingParentPrim
- std::optional<std::string> isaacsim::foundation::utils::getFirstMatchingParentPrim(
- const std::string &path,
- std::function<bool(const std::string&)> predicate,
- bool includeSelf = false,
Returns the first ancestor of
pathfor whichpredicatereturnstrue.Walks up the parent chain on the default stage, testing each prim against
predicate, and returns the first match. Traversal stops before reaching the stage pseudoroot ("/"); the pseudoroot is never tested or returned.When
includeSelfisfalsethe walk starts from the direct parent ofpath. WhenincludeSelfistruethe walk starts frompathitself.See also
getFirstMatchingChildPrim()
- Parameters:
path – [in] USD path whose ancestors are searched on the default stage.
predicate – [in] Callable invoked with the string path of each ancestor; return
trueto select that ancestor.includeSelf – [in] Whether to test
pathitself before walking up to its parents.
- Returns:
The path of the first matching ancestor, or
std::nulloptif no match is found before reaching the pseudoroot.