All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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"
34 #include "pxr/usd/sdf/primSpec.h"
35 
36 PXR_NAMESPACE_OPEN_SCOPE
37 
38 
40 
79 {
80 public:
81 
84  USD_API
85  UsdEditTarget();
86 
93  USD_API
94  UsdEditTarget(const SdfLayerHandle &layer,
95  SdfLayerOffset offset = SdfLayerOffset());
96 
99  USD_API
100  UsdEditTarget(const SdfLayerRefPtr &layer,
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 
146  USD_API
147  SdfPath MapToSpecPath(const SdfPath &scenePath) const;
148 
155  USD_API
156  SdfPrimSpecHandle
157  GetPrimSpecForScenePath(const SdfPath &scenePath) const;
158 
159  USD_API
160  SdfPropertySpecHandle
161  GetPropertySpecForScenePath(const SdfPath &scenePath) const;
162 
163  USD_API
164  SdfSpecHandle
165  GetSpecForScenePath(const SdfPath &scenePath) const;
166 
169  const PcpMapFunction &
170  GetMapFunction() const { return _mapping; }
171 
181  USD_API
182  UsdEditTarget ComposeOver(const UsdEditTarget &weaker) const;
183 
184 private:
185 
186  UsdEditTarget(const SdfLayerHandle &layer,
187  const PcpMapFunction &mapping);
188 
189  SdfLayerHandle _layer;
190  PcpMapFunction _mapping;
191 };
192 
193 
194 PXR_NAMESPACE_CLOSE_SCOPE
195 
196 #endif // PXR_USD_USD_EDIT_TARGET_H
#define TF_DECLARE_WEAK_PTRS(type)
Define standard weak pointer types.
Definition: declarePtrs.h:62
PcpNode represents a node in an expression tree for compositing scene description.
Definition: node.h:67
USD_API bool operator==(const UsdEditTarget &other) const
Equality comparison.
The outermost container for scene description, which owns and presents composed prims as a scenegraph...
Definition: stage.h:145
bool IsNull() const
Return true if this EditTarget is null.
Definition: editTarget.h:133
bool operator!=(const UsdEditTarget &other) const
Inequality comparison.
Definition: editTarget.h:127
Defines a mapping from scene graph paths to Sdf spec paths in a SdfLayer where edits should be direct...
Definition: editTarget.h:78
bool IsValid() const
Return true if this EditTarget is valid, false otherwise.
Definition: editTarget.h:137
USD_API SdfPrimSpecHandle GetPrimSpecForScenePath(const SdfPath &scenePath) const
Convenience function for getting the PrimSpec in the edit target's layer for scenePath.
A function that maps values from one namespace (and time domain) to another.
Definition: mapFunction.h:80
A path value used to locate objects in layers or scenegraphs.
Definition: path.h:288
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...
USD_API UsdEditTarget ComposeOver(const UsdEditTarget &weaker) const
Return a new EditTarget composed over weaker.
static USD_API UsdEditTarget ForLocalDirectVariant(const SdfLayerHandle &layer, const SdfPath &varSelPath)
Convenience constructor for editing a direct variant in a local LayerStack.
USD_API UsdEditTarget()
Construct a null EditTarget.
Represents a time offset and scale between layers.
Definition: layerOffset.h:61
const PcpMapFunction & GetMapFunction() const
Returns the PcpMapFunction representing the map from source specs (including any variant selections) ...
Definition: editTarget.h:170
const SdfLayerHandle & GetLayer() const
Return the layer this EditTarget contains.
Definition: editTarget.h:140