7#ifndef PXR_USD_SDF_NAMESPACE_EDIT_H
8#define PXR_USD_SDF_NAMESPACE_EDIT_H
13#include "pxr/usd/sdf/api.h"
14#include "pxr/usd/sdf/path.h"
21PXR_NAMESPACE_OPEN_SCOPE
39 static const Index
Same = -2;
46 Index index_ =
AtEnd) :
72 const Path& newParentPath,
85 const Path& newParentPath,
96 SDF_API
bool operator==(
const This& rhs)
const;
97 SDF_API
bool operator!=(
const This& rhs)
const;
126 const std::string&
reason);
150 return lhs < rhs ? lhs : rhs;
207 _edits.push_back(edit);
274 bool fixBackpointers =
true)
const;
280PXR_NAMESPACE_CLOSE_SCOPE
A description of an arbitrarily complex namespace edit.
SDF_API SdfBatchNamespaceEdit()
Create an empty sequence of edits.
void Add(const SdfNamespaceEdit::Path ¤tPath, const SdfNamespaceEdit::Path &newPath, SdfNamespaceEdit::Index index=SdfNamespaceEdit::AtEnd)
Add a namespace edit.
void Add(const SdfNamespaceEdit &edit)
Add a namespace edit.
const SdfNamespaceEditVector & GetEdits() const
Returns the edits.
std::function< bool(const SdfNamespaceEdit &, std::string *)> CanEdit
Functor that returns true iff the namespace edit will succeed.
SDF_API bool Process(SdfNamespaceEditVector *processedEdits, const HasObjectAtPath &hasObjectAtPath, const CanEdit &canEdit, SdfNamespaceEditDetailVector *details=NULL, bool fixBackpointers=true) const
Validate the edits and generate a possibly more efficient edit sequence.
std::function< bool(const SdfPath &)> HasObjectAtPath
Functor that returns true iff an object exists at the given path.
A path value used to locate objects in layers or scenegraphs.
SDF_API SdfPath GetParentPath() const
Return the path that identifies this path's namespace parent.
static SDF_API const SdfPath & EmptyPath()
The empty path value, equivalent to SdfPath().
SDF_API SdfPath ReplacePrefix(const SdfPath &oldPrefix, const SdfPath &newPrefix, bool fixTargetPaths=true) const
Returns a path with all occurrences of the prefix path oldPrefix replaced with the prefix path newPre...
SDF_API SdfPath ReplaceName(TfToken const &newName) const
Return a copy of this path with its final component changed to newName.
Token for efficient comparison, assignment, and hashing of known strings.
GF_API std::ostream & operator<<(std::ostream &, const GfBBox3d &)
Output a GfBBox3d using the format [(range) matrix zeroArea].
std::vector< SdfNamespaceEditDetail > SdfNamespaceEditDetailVector
A sequence of SdfNamespaceEditDetail.
SdfNamespaceEditDetail::Result CombineResult(SdfNamespaceEditDetail::Result lhs, SdfNamespaceEditDetail::Result rhs)
Combine two results, yielding Error over Unbatched over Okay.
SdfNamespaceEditDetail::Result CombineUnbatched(SdfNamespaceEditDetail::Result other)
Combine a result with Unbatched, yielding Error over Unbatched over Okay.
std::vector< SdfNamespaceEdit > SdfNamespaceEditVector
A sequence of SdfNamespaceEdit.
SdfNamespaceEditDetail::Result CombineError(SdfNamespaceEditDetail::Result)
Combine a result with Error, yielding Error over Unbatched over Okay.
Detailed information about a namespace edit.
Result
Validity of an edit.
@ Okay
Edit will succeed as a batch.
@ Unbatched
Edit will succeed but not batched.
SdfNamespaceEdit edit
The edit.
std::string reason
The reason the edit will not succeed cleanly.
static This Rename(const Path ¤tPath, const TfToken &name)
Returns a namespace edit that renames the prim or property at currentPath to name.
static This Remove(const Path ¤tPath)
Returns a namespace edit that removes the object at currentPath.
static This Reparent(const Path ¤tPath, const Path &newParentPath, Index index)
Returns a namespace edit to reparent the prim or property at currentPath to be under newParentPath at...
static const Index Same
Special index that means don't move.
Index index
Index for prim insertion.
static const Index AtEnd
Special index that means at the end.
static This Reorder(const Path ¤tPath, Index index)
Returns a namespace edit to reorder the prim or property at currentPath to index index.
Path newPath
Path of the object when this edit ends.
static This ReparentAndRename(const Path ¤tPath, const Path &newParentPath, const TfToken &name, Index index)
Returns a namespace edit to reparent the prim or property at currentPath to be under newParentPath at...
Path currentPath
Path of the object when this edit starts.
SdfNamespaceEdit(const Path ¤tPath_, const Path &newPath_, Index index_=AtEnd)
The fully general edit.
SdfNamespaceEdit()
The default edit maps the empty path to the empty path.