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 const UsdStageRefPtr &stage,
51 const UsdStageRefPtr &stage,
246 enum class _EditType {
255 struct _EditDescription {
263 _EditType editType = _EditType::Invalid;
274 struct _ProcessedEdit
278 std::vector<std::string> errors;
281 _EditDescription editDescription;
285 SdfLayerHandleVector layersToEdit;
288 bool willAuthorRelocates =
false;
293 struct TargetPathListOpEdit {
298 SdfPropertySpecHandle propertySpec;
305 SdfPathListOp newFieldValue;
307 std::vector<TargetPathListOpEdit> targetPathListOpEdits;
317 std::vector<std::string> targetPathListOpErrors;
324 bool CanApply(std::string *whyNot)
const;
328 bool _AddPrimDelete(
const SdfPath &oldPath);
331 bool _AddPrimMove(
const SdfPath &oldPath,
const SdfPath &newPath);
334 bool _AddPropertyDelete(
const SdfPath &oldPath);
337 bool _AddPropertyMove(
const SdfPath &oldPath,
const SdfPath &newPath);
340 void _ClearProcessedEdits();
344 void _ProcessEditsIfNeeded()
const;
349 class _EditProcessor;
351 UsdStageRefPtr _stage;
354 using _StageSet = std::unordered_set<UsdStageRefPtr, TfHash>;
355 _StageSet _dependentStages;
356 EditOptions _editOptions;
357 _EditDescription _editDescription;
358 mutable std::optional<_ProcessedEdit> _processedEdit;
361PXR_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 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 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 bool CanApplyEdits(std::string *whyNot=nullptr) const
Returns whether all the added namespace edits stored in this to namespace editor can be applied to it...
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...
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.