ValidChildNameCache#

Fully qualified name: usdex::core::ValidChildNameCache

class ValidChildNameCache#

A caching mechanism for valid and unique child prim names.

For best performance, this object should be reused for multiple name requests.

It is not valid to request child names from prims from multiple stages as only the prim path is used as the cache key.

Warning

This class does not automatically invalidate cached values based on changes to the stage from which values were cached. Additionally, a separate instance of this class should be used per-thread, calling methods from multiple threads is not safe.

Public Functions

ValidChildNameCache()#
~ValidChildNameCache()#
pxr::TfTokenVector getValidChildNames(
const pxr::UsdPrim &prim,
const std::vector<std::string> &names,
)#

Take a prim and a vector of the preferred names. Return a matching vector of valid and unique names as the child names of the given prim.

Parameters:
  • prim – The USD prim where the given prim names should live under.

  • names – A vector of preferred prim names.

Returns:

A vector of valid and unique names.

pxr::TfToken getValidChildName(
const pxr::UsdPrim &prim,
const std::string &name,
)#

Take a prim and a preferred name. Return a valid and unique name for use as the child name of the given prim.

Parameters:
  • prim – The prim that the child name should be valid for.

  • name – Preferred prim name.

Returns:

Valid and unique name.

void update(const pxr::UsdPrim &prim)#

Update the name cache for a Prim to include all existing children.

This does not clear the cache, so any names that have been previously returned will still be reserved.

Parameters:

prim – The prim that child names should be updated for.

void clear(const pxr::UsdPrim &prim)#

Clear the name cache for a Prim.

Parameters:

prim – The prim that child names should be cleared for.