7#ifndef PXR_USD_USD_NAMESPACE_EDITOR_H
8#define PXR_USD_USD_NAMESPACE_EDITOR_H
13#include "pxr/usd/usd/api.h"
16#include "pxr/usd/pcp/dependentNamespaceEditUtils.h"
19PXR_NAMESPACE_OPEN_SCOPE
46 std::vector<std::string> errors;
47 std::vector<std::string> warnings;
51 return errors.empty();
60 const UsdStageRefPtr &stage,
61 EditOptions &&editOptions);
65 const UsdStageRefPtr &stage,
66 const EditOptions &editOptions);
279 enum class _EditType {
288 struct _EditDescription {
296 _EditType editType = _EditType::Invalid;
307 struct _ProcessedEdit
311 std::vector<std::string> errors;
316 std::vector<std::string> warnings;
319 _EditDescription editDescription;
323 SdfLayerHandleVector layersToEdit;
326 bool willAuthorRelocates =
false;
331 struct TargetPathListOpEdit {
336 SdfPropertySpecHandle propertySpec;
343 SdfPathListOp newFieldValue;
345 std::vector<TargetPathListOpEdit> targetPathListOpEdits;
358 UsdNamespaceEditor::CanApplyResult CanApply()
const;
362 bool _AddPrimDelete(
const SdfPath &oldPath);
365 bool _AddPrimMove(
const SdfPath &oldPath,
const SdfPath &newPath);
368 bool _AddPropertyDelete(
const SdfPath &oldPath);
371 bool _AddPropertyMove(
const SdfPath &oldPath,
const SdfPath &newPath);
374 void _ClearProcessedEdits();
378 void _ProcessEditsIfNeeded()
const;
383 class _EditProcessor;
385 UsdStageRefPtr _stage;
388 using _StageSet = std::unordered_set<UsdStageRefPtr, TfHash>;
389 _StageSet _dependentStages;
390 EditOptions _editOptions;
391 _EditDescription _editDescription;
392 mutable std::optional<_ProcessedEdit> _processedEdit;
395PXR_NAMESPACE_CLOSE_SCOPE
Structure for bundling all the edits that need to be performed in order to perform a namespace edit a...
A path value used to locate objects in layers or scenegraphs.
SDF_API bool IsPrimPropertyPath() const
Returns whether the path identifies a prim's property.
Token for efficient comparison, assignment, and hashing of known strings.
USD_API bool MovePrimAtPath(const SdfPath &path, const SdfPath &newPath)
Adds an edit operation to move the composed prim at the given path on this namespace editor's stage t...
USD_API bool DeletePrimAtPath(const SdfPath &path)
Adds an edit operation to delete the composed prim at the given path from this namespace editor's sta...
USD_API bool RenameProperty(const UsdProperty &property, const TfToken &newName)
Adds an edit operation to rename the composed property at the path of property on this namespace edit...
USD_API bool ApplyEdits()
Applies all the added namespace edits stored in this to namespace editor to its stage by authoring al...
USD_API bool ReparentProperty(const UsdProperty &property, const UsdPrim &newParent)
Adds an edit operation to reparent the composed property at the path of property on this namespace ed...
USD_API CanApplyResult CanApplyEdits() const
Returns whether all the added namespace edits stored in this to namespace editor can be applied to it...
USD_API bool DeleteProperty(const UsdProperty &property)
Adds an edit operation to delete the composed property at the path of property from this namespace ed...
USD_API SdfLayerHandleVector GetLayersToEdit()
Returns the list of layers that will be edited if ApplyEdits() is called.
USD_API bool ReparentPrim(const UsdPrim &prim, const UsdPrim &newParent)
Adds an edit operation to reparent the composed prim at the path of prim on this namespace editor's s...
USD_API bool MovePropertyAtPath(const SdfPath &path, const SdfPath &newPath)
Adds an edit operation to move the composed property at the given path on this namespace editor's sta...
USD_API bool ReparentProperty(const UsdProperty &property, const UsdPrim &newParent, const TfToken &newName)
Adds an edit operation to reparent the composed property at the path of property on this namespace ed...
USD_API void AddDependentStage(const UsdStageRefPtr &stage)
Adds the given stage as a dependent stage of this namespace editor.
USD_API bool ReparentPrim(const UsdPrim &prim, const UsdPrim &newParent, const TfToken &newName)
Adds an edit operation to reparent the composed prim at the path of prim on this namespace editor's s...
USD_API void SetDependentStages(const UsdStageRefPtrVector &stages)
Sets the list of dependent stages for this namespace editor to stages.
USD_API bool RenamePrim(const UsdPrim &prim, const TfToken &newName)
Adds an edit operation to rename the composed prim at the path of prim on this namespace editor's sta...
USD_API bool CanApplyEdits(std::string *whyNot) const
bool allowRelocatesAuthoring
Whether the namespace editor will allow the authoring of relocates in order to perform edits that wou...
USD_API bool DeletePrim(const UsdPrim &prim)
Adds an edit operation to delete the composed prim at the path of prim from this namespace editor's s...
USD_API bool DeletePropertyAtPath(const SdfPath &path)
Adds an edit operation to delete the composed property at the given path from this namespace editor's...
USD_API void RemoveDependentStage(const UsdStageRefPtr &stage)
Removes the given stage as a dependent stage of this namespace editor.
Structure for holding the options for how the namespace editor will behave when trying to perform edi...
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
Base class for UsdAttribute and UsdRelationship scenegraph objects.
@ Invalid
Invalid or unknown schema kind.