All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
namespaceEdits.h File Reference
#include "pxr/pxr.h"
#include "pxr/usd/pcp/api.h"
#include "pxr/usd/pcp/cache.h"
#include "pxr/base/tf/hashset.h"
#include <string>
#include <vector>
+ Include dependency graph for namespaceEdits.h:

Go to the source code of this file.


struct  PcpNamespaceEdits
 Sites that must respond to a namespace edit. More...
struct  PcpNamespaceEdits::CacheSite
 Cache site that must respond to a namespace edit. More...
struct  PcpNamespaceEdits::LayerStackSite


 TF_DECLARE_WEAK_AND_REF_PTRS (Pcp_LayerStackRegistry)
PCP_API PcpNamespaceEdits PcpComputeNamespaceEdits (const PcpCache *primaryCache, const std::vector< PcpCache * > &caches, const SdfPath &curPath, const SdfPath &newPath, const SdfLayerHandle &relocatesLayer)

Function Documentation

PCP_API PcpNamespaceEdits PcpComputeNamespaceEdits ( const PcpCache primaryCache,
const std::vector< PcpCache * > &  caches,
const SdfPath curPath,
const SdfPath newPath,
const SdfLayerHandle &  relocatesLayer 

Returns the changes caused in any cache in caches due to namespace editing the object at curPath in this cache to have the path newPath. caches should have all caches, including this cache. If caches includes this cache then the result includes the changes caused at curPath in this cache itself.

To keep everything consistent, a namespace edit requires that everything using the namespace edited site to be changed in an appropriate way. For example, if a referenced prim /A is renamed to /B then everything referencing /A must be changed to reference /B instead. There are many other possibilities.

One possibility is that there are no opinions at curPath in this cache's layer stack and the site exists due to some ancestor arc. This requires a relocation and only sites using curPath that include the layer with the relocation must be changed in response. To find those sites, relocatesLayer indicates which layer the client will write the relocation to.

Clients must perform the changes to correctly perform a namespace edit. All changes must be performed in a change block, otherwise notices could be sent prematurely.

This method only works when the affected prim indexes have been computed. In general, this means you must have computed the prim index of everything in any existing cache, otherwise you might miss changes to objects in those caches that use the namespace edited object. Using the above example, if a prim with an uncomputed prim index referenced /A then this method would not report that prim. As a result that prim would continue to reference /A, which no longer exists.

TF_DECLARE_WEAK_AND_REF_PTRS ( Pcp_LayerStackRegistry  )