Loading...
Searching...
No Matches
dependentNamespaceEditUtils.h
1//
2// Copyright 2024 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef PXR_USD_PCP_DEPENDENT_NAMESPACE_EDIT_UTILS_H
8#define PXR_USD_PCP_DEPENDENT_NAMESPACE_EDIT_UTILS_H
9
10#include "pxr/pxr.h"
11#include "pxr/usd/pcp/api.h"
12#include "pxr/usd/pcp/cache.h"
13#include "pxr/usd/sdf/path.h"
15#include "pxr/base/tf/hash.h"
16#include "pxr/base/tf/token.h"
17#include "pxr/base/vt/value.h"
18
19#include <string>
20#include <unordered_map>
21#include <vector>
22
23PXR_NAMESPACE_OPEN_SCOPE
24
25SDF_DECLARE_HANDLES(SdfLayer);
27
33public:
38 SdfLayerHandle layer;
39
42
45
48 };
49
51 std::vector<CompositionFieldEdit> compositionFieldEdits;
52
56 SdfPath oldPath;
57 SdfPath newPath;
58 };
59 using MoveEditDescriptionVector = std::vector<MoveEditDescription>;
60
62 using LayerSpecMoveEdits = std::unordered_map<
63 SdfLayerHandle, MoveEditDescriptionVector, TfHash>;
64 LayerSpecMoveEdits layerSpecMoves;
65
69 std::unordered_map<SdfLayerHandle, SdfRelocates, TfHash>;
70 LayerRelocatesEdits dependentRelocatesEdits;
71
74 std::vector<std::string> errors;
75
78 std::vector<std::string> warnings;
79
85 std::unordered_map<const PcpCache *, MoveEditDescriptionVector>
87};
88
101PCP_API
103PcpGatherDependentNamespaceEdits(
104 const SdfPath &oldPrimPath,
105 const SdfPath &newPrimPath,
106 const SdfLayerHandleVector &affectedLayers,
107 const PcpLayerStackRefPtr &addRelocatesToLayerStack,
108 const SdfLayerHandle &addRelocatesToLayerStackEditLayer,
109 const std::vector<const PcpCache *> &dependentCaches);
110
117PCP_API
118SdfLayerHandleVector
119PcpGatherLayersToEditForSpecMove(
120 const PcpLayerStackRefPtr &layerStack,
121 const SdfPath &oldSpecPath,
122 const SdfPath &newSpecPath,
123 std::vector<std::string> *errors);
124
125PXR_NAMESPACE_CLOSE_SCOPE
126
127#endif // PXR_USD_PCP_NAMESPACE_EDITS_H
Structure for bundling all the edits that need to be performed in order to perform a namespace edit a...
std::vector< std::string > warnings
Warnings encountered during the processing of the dependent namespace edits.
VtValue newFieldValue
New value of the composition field to set.
std::unordered_map< const PcpCache *, MoveEditDescriptionVector > dependentCachePathChanges
Lists of composed prim paths in each affected cache whose prim indexes will need to be recomputed aft...
SdfLayerHandle layer
Layer containing the prim spec to edit.
std::unordered_map< SdfLayerHandle, SdfRelocates, TfHash > LayerRelocatesEdits
Map of layer to relocates value to set in the layer metadata relocates field.
std::unordered_map< SdfLayerHandle, MoveEditDescriptionVector, TfHash > LayerSpecMoveEdits
Map of layer to the spec moves edits to perform on the layer.
std::vector< std::string > errors
Errors encountered during the processing of the dependent namespace edits.
std::vector< CompositionFieldEdit > compositionFieldEdits
List of all composition fields edits to perform.
Description of an edit to a prim spec composition field, such as references, inherits,...
Description of move edit which consists of the old (source) path and the new (destination) path.
Represents a stack of layers that contribute opinions to composition.
Definition: layerStack.h:50
A scene description container that can combine with other such containers to form simple component as...
Definition: layer.h:84
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:274
A user-extensible hashing mechanism for use with runtime hash tables.
Definition: hash.h:472
Token for efficient comparison, assignment, and hashing of known strings.
Definition: token.h:71
Provides a container which may hold any type, and provides introspection and iteration over array typ...
Definition: value.h:152
#define TF_DECLARE_REF_PTRS(type)
Define standard ref pointer types.
Definition: declarePtrs.h:58
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...