All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
editTarget.h
1//
2// Copyright 2016 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_USD_EDIT_TARGET_H
8#define PXR_USD_USD_EDIT_TARGET_H
9
10#include "pxr/pxr.h"
11#include "pxr/usd/usd/api.h"
13#include "pxr/usd/pcp/mapFunction.h"
14#include "pxr/usd/pcp/node.h"
16#include "pxr/usd/sdf/layer.h"
17#include "pxr/usd/sdf/path.h"
20
21PXR_NAMESPACE_OPEN_SCOPE
22
23
25
64{
65public:
66
69 USD_API
71
78 USD_API
79 UsdEditTarget(const SdfLayerHandle &layer,
81
84 USD_API
87
91 USD_API
92 UsdEditTarget(const SdfLayerHandle &layer, const PcpNodeRef &node);
93
96 USD_API
97 UsdEditTarget(const SdfLayerRefPtr &layer, const PcpNodeRef &node);
98
102 USD_API
103 static UsdEditTarget
104 ForLocalDirectVariant(const SdfLayerHandle &layer,
105 const SdfPath &varSelPath);
106
108 USD_API
109 bool operator==(const UsdEditTarget &other) const;
110
112 bool operator!=(const UsdEditTarget &other) const {
113 return !(*this == other);
114 }
115
118 bool IsNull() const { return *this == UsdEditTarget(); }
119
122 bool IsValid() const { return _layer; }
123
125 const SdfLayerHandle &GetLayer() const & { return _layer; }
126 SdfLayerHandle GetLayer() && { return std::move(_layer); }
127
132 USD_API
133 SdfPath MapToSpecPath(const SdfPath &scenePath) const;
134
141 USD_API
142 SdfPrimSpecHandle
143 GetPrimSpecForScenePath(const SdfPath &scenePath) const;
144
151 USD_API
152 SdfPropertySpecHandle
153 GetPropertySpecForScenePath(const SdfPath &scenePath) const;
154
161 USD_API
162 SdfAttributeSpecHandle
163 GetAttributeSpecForScenePath(const SdfPath &scenePath) const;
164
172 USD_API
173 SdfRelationshipSpecHandle
175
182 USD_API
183 SdfSpecHandle
184 GetSpecForScenePath(const SdfPath &scenePath) const;
185
188 const PcpMapFunction &
189 GetMapFunction() const { return _mapping; }
190
200 USD_API
202
203private:
204
205 UsdEditTarget(const SdfLayerHandle &layer,
206 const PcpMapFunction &mapping);
207
208 SdfLayerHandle _layer;
209 PcpMapFunction _mapping;
210};
211
212
213PXR_NAMESPACE_CLOSE_SCOPE
214
215#endif // PXR_USD_USD_EDIT_TARGET_H
A function that maps values from one namespace (and time domain) to another.
Definition: mapFunction.h:65
PcpNode represents a node in an expression tree for compositing scene description.
Definition: node.h:47
Represents a time offset and scale between layers.
Definition: layerOffset.h:44
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:274
Defines a mapping from scene graph paths to Sdf spec paths in a SdfLayer where edits should be direct...
Definition: editTarget.h:64
USD_API SdfPrimSpecHandle GetPrimSpecForScenePath(const SdfPath &scenePath) const
Convenience function for getting the PrimSpec in the edit target's layer for scenePath.
USD_API UsdEditTarget ComposeOver(const UsdEditTarget &weaker) const
Return a new EditTarget composed over weaker.
USD_API UsdEditTarget(const SdfLayerHandle &layer, const PcpNodeRef &node)
Construct an EditTarget with layer and node.
USD_API bool operator==(const UsdEditTarget &other) const
Equality comparison.
USD_API SdfSpecHandle GetSpecForScenePath(const SdfPath &scenePath) const
Convenience function for getting the Spec in the edit target's layer for scenePath.
USD_API UsdEditTarget(const SdfLayerRefPtr &layer, SdfLayerOffset offset=SdfLayerOffset())
Convenience implicit conversion from SdfLayerRefPtr.
USD_API UsdEditTarget()
Construct a null EditTarget.
USD_API UsdEditTarget(const SdfLayerHandle &layer, SdfLayerOffset offset=SdfLayerOffset())
Constructor.
static USD_API UsdEditTarget ForLocalDirectVariant(const SdfLayerHandle &layer, const SdfPath &varSelPath)
Convenience constructor for editing a direct variant in a local LayerStack.
const SdfLayerHandle & GetLayer() const &
Return the layer this EditTarget contains.
Definition: editTarget.h:125
bool operator!=(const UsdEditTarget &other) const
Inequality comparison.
Definition: editTarget.h:112
const PcpMapFunction & GetMapFunction() const
Returns the PcpMapFunction representing the map from source specs (including any variant selections) ...
Definition: editTarget.h:189
bool IsNull() const
Return true if this EditTarget is null.
Definition: editTarget.h:118
bool IsValid() const
Return true if this EditTarget is valid, false otherwise.
Definition: editTarget.h:122
USD_API SdfPropertySpecHandle GetPropertySpecForScenePath(const SdfPath &scenePath) const
Convenience function for getting the PropertySpec in the edit target's layer for scenePath.
USD_API UsdEditTarget(const SdfLayerRefPtr &layer, const PcpNodeRef &node)
Convenience constructor taking SdfLayerRefPtr.
USD_API SdfRelationshipSpecHandle GetRelationshipSpecForScenePath(const SdfPath &scenePath) const
Convenience function for getting the RelationshipSpec in the edit target's layer for scenePath.
USD_API SdfAttributeSpecHandle GetAttributeSpecForScenePath(const SdfPath &scenePath) const
Convenience function for getting the AttributeSpec in the edit target's layer for scenePath.
USD_API SdfPath MapToSpecPath(const SdfPath &scenePath) const
Map the provided scenePath into a SdfSpec path for the EditTarget's layer, according to the EditTarge...
The outermost container for scene description, which owns and presents composed prims as a scenegraph...
Definition: stage.h:136
#define TF_DECLARE_WEAK_PTRS(type)
Define standard weak pointer types.
Definition: declarePtrs.h:45