Loading...
Searching...
No Matches
editTarget.h
1//
2// Copyright 2016 Pixar
3//
4// Licensed under the Apache License, Version 2.0 (the "Apache License")
5// with the following modification; you may not use this file except in
6// compliance with the Apache License and the following modification to it:
7// Section 6. Trademarks. is deleted and replaced with:
8//
9// 6. Trademarks. This License does not grant permission to use the trade
10// names, trademarks, service marks, or product names of the Licensor
11// and its affiliates, except as required to comply with Section 4(c) of
12// the License and to reproduce the content of the NOTICE file.
13//
14// You may obtain a copy of the Apache License at
15//
16// http://www.apache.org/licenses/LICENSE-2.0
17//
18// Unless required by applicable law or agreed to in writing, software
19// distributed under the Apache License with the above modification is
20// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21// KIND, either express or implied. See the Apache License for the specific
22// language governing permissions and limitations under the Apache License.
23//
24#ifndef PXR_USD_USD_EDIT_TARGET_H
25#define PXR_USD_USD_EDIT_TARGET_H
26
27#include "pxr/pxr.h"
28#include "pxr/usd/usd/api.h"
30#include "pxr/usd/pcp/mapFunction.h"
31#include "pxr/usd/pcp/node.h"
32#include "pxr/usd/sdf/layer.h"
33#include "pxr/usd/sdf/path.h"
35
36PXR_NAMESPACE_OPEN_SCOPE
37
38
40
79{
80public:
81
84 USD_API
86
93 USD_API
94 UsdEditTarget(const SdfLayerHandle &layer,
96
99 USD_API
101 SdfLayerOffset offset = SdfLayerOffset());
102
106 USD_API
107 UsdEditTarget(const SdfLayerHandle &layer, const PcpNodeRef &node);
108
111 USD_API
112 UsdEditTarget(const SdfLayerRefPtr &layer, const PcpNodeRef &node);
113
117 USD_API
118 static UsdEditTarget
119 ForLocalDirectVariant(const SdfLayerHandle &layer,
120 const SdfPath &varSelPath);
121
123 USD_API
124 bool operator==(const UsdEditTarget &other) const;
125
127 bool operator!=(const UsdEditTarget &other) const {
128 return !(*this == other);
129 }
130
133 bool IsNull() const { return *this == UsdEditTarget(); }
134
137 bool IsValid() const { return _layer; }
138
140 const SdfLayerHandle &GetLayer() const & { return _layer; }
141 SdfLayerHandle GetLayer() && { return std::move(_layer); }
142
147 USD_API
148 SdfPath MapToSpecPath(const SdfPath &scenePath) const;
149
156 USD_API
157 SdfPrimSpecHandle
158 GetPrimSpecForScenePath(const SdfPath &scenePath) const;
159
160 USD_API
161 SdfPropertySpecHandle
162 GetPropertySpecForScenePath(const SdfPath &scenePath) const;
163
164 USD_API
165 SdfSpecHandle
166 GetSpecForScenePath(const SdfPath &scenePath) const;
167
170 const PcpMapFunction &
171 GetMapFunction() const { return _mapping; }
172
182 USD_API
184
185private:
186
187 UsdEditTarget(const SdfLayerHandle &layer,
188 const PcpMapFunction &mapping);
189
190 SdfLayerHandle _layer;
191 PcpMapFunction _mapping;
192};
193
194
195PXR_NAMESPACE_CLOSE_SCOPE
196
197#endif // PXR_USD_USD_EDIT_TARGET_H
A function that maps values from one namespace (and time domain) to another.
Definition: mapFunction.h:82
PcpNode represents a node in an expression tree for compositing scene description.
Definition: node.h:64
Represents a time offset and scale between layers.
Definition: layerOffset.h:61
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:290
Defines a mapping from scene graph paths to Sdf spec paths in a SdfLayer where edits should be direct...
Definition: editTarget.h:79
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 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:140
bool operator!=(const UsdEditTarget &other) const
Inequality comparison.
Definition: editTarget.h:127
const PcpMapFunction & GetMapFunction() const
Returns the PcpMapFunction representing the map from source specs (including any variant selections) ...
Definition: editTarget.h:171
bool IsNull() const
Return true if this EditTarget is null.
Definition: editTarget.h:133
bool IsValid() const
Return true if this EditTarget is valid, false otherwise.
Definition: editTarget.h:137
USD_API UsdEditTarget(const SdfLayerRefPtr &layer, const PcpNodeRef &node)
Convenience constructor taking SdfLayerRefPtr.
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:151
#define TF_DECLARE_WEAK_PTRS(type)
Define standard weak pointer types.
Definition: declarePtrs.h:62