Loading...
Searching...
No Matches
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"
15#include "pxr/usd/sdf/layer.h"
16#include "pxr/usd/sdf/path.h"
18
19PXR_NAMESPACE_OPEN_SCOPE
20
21
23
62{
63public:
64
67 USD_API
69
76 USD_API
77 UsdEditTarget(const SdfLayerHandle &layer,
79
82 USD_API
85
89 USD_API
90 UsdEditTarget(const SdfLayerHandle &layer, const PcpNodeRef &node);
91
94 USD_API
95 UsdEditTarget(const SdfLayerRefPtr &layer, const PcpNodeRef &node);
96
100 USD_API
101 static UsdEditTarget
102 ForLocalDirectVariant(const SdfLayerHandle &layer,
103 const SdfPath &varSelPath);
104
106 USD_API
107 bool operator==(const UsdEditTarget &other) const;
108
110 bool operator!=(const UsdEditTarget &other) const {
111 return !(*this == other);
112 }
113
116 bool IsNull() const { return *this == UsdEditTarget(); }
117
120 bool IsValid() const { return _layer; }
121
123 const SdfLayerHandle &GetLayer() const & { return _layer; }
124 SdfLayerHandle GetLayer() && { return std::move(_layer); }
125
130 USD_API
131 SdfPath MapToSpecPath(const SdfPath &scenePath) const;
132
139 USD_API
140 SdfPrimSpecHandle
141 GetPrimSpecForScenePath(const SdfPath &scenePath) const;
142
143 USD_API
144 SdfPropertySpecHandle
145 GetPropertySpecForScenePath(const SdfPath &scenePath) const;
146
147 USD_API
148 SdfSpecHandle
149 GetSpecForScenePath(const SdfPath &scenePath) const;
150
153 const PcpMapFunction &
154 GetMapFunction() const { return _mapping; }
155
165 USD_API
167
168private:
169
170 UsdEditTarget(const SdfLayerHandle &layer,
171 const PcpMapFunction &mapping);
172
173 SdfLayerHandle _layer;
174 PcpMapFunction _mapping;
175};
176
177
178PXR_NAMESPACE_CLOSE_SCOPE
179
180#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:62
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:123
bool operator!=(const UsdEditTarget &other) const
Inequality comparison.
Definition: editTarget.h:110
const PcpMapFunction & GetMapFunction() const
Returns the PcpMapFunction representing the map from source specs (including any variant selections) ...
Definition: editTarget.h:154
bool IsNull() const
Return true if this EditTarget is null.
Definition: editTarget.h:116
bool IsValid() const
Return true if this EditTarget is valid, false otherwise.
Definition: editTarget.h:120
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:134
#define TF_DECLARE_WEAK_PTRS(type)
Define standard weak pointer types.
Definition: declarePtrs.h:45