24 #ifndef PXR_USD_USD_VARIANT_SETS_H 25 #define PXR_USD_USD_VARIANT_SETS_H 28 #include "pxr/usd/usd/api.h" 30 #include "pxr/usd/usd/editTarget.h" 38 PXR_NAMESPACE_OPEN_SCOPE
76 bool AddVariant(
const std::string& variantName,
165 std::pair<UsdStagePtr, UsdEditTarget>
174 std::string
const &
GetName()
const {
return _variantSetName; }
180 return static_cast<bool>(_prim);
184 explicit operator bool()
const {
190 const std::string &variantSetName)
192 , _variantSetName(variantSetName)
196 SdfPrimSpecHandle _CreatePrimSpecForEditing();
200 std::string _variantSetName;
246 bool GetNames(std::vector<std::string>* names)
const;
250 std::vector<std::string>
GetNames()
const;
252 UsdVariantSet operator[](
const std::string& variantSetName)
const {
274 bool SetSelection(
const std::string& variantSetName,
275 const std::string& variantName);
297 PXR_NAMESPACE_CLOSE_SCOPE
299 #endif //PXR_USD_USD_VARIANT_SETS_H A scene description container that can combine with other such containers to form simple component as...
UsdListPosition
Specifies a position to add items to lists.
USD_API std::pair< UsdStagePtr, UsdEditTarget > GetVariantEditContext(const SdfLayerHandle &layer=SdfLayerHandle()) const
Helper function for configuring a UsdStage's EditTarget to author into the currently selected variant...
USD_API bool BlockVariantSelection()
Block any weaker selections for this VariantSet by authoring an empty string at the stage's current E...
USD_API UsdEditTarget GetVariantEditTarget(const SdfLayerHandle &layer=SdfLayerHandle()) const
Return a UsdEditTarget that edits the currently selected variant in this VariantSet in layer.
std::map< std::string, std::string > SdfVariantSelectionMap
A map of reference variant set names to variants in those sets.
USD_API UsdVariantSet GetVariantSet(const std::string &variantSetName) const
Return a UsdVariantSet object for variantSetName.
USD_API bool HasAuthoredVariantSelection(std::string *value=nullptr) const
Returns true if there is a selection authored for this VariantSet in any layer.
USD_API bool ClearVariantSelection()
Clear any selection for this VariantSet from the current EditTarget.
UsdPrim const & GetPrim() const
Return this VariantSet's held prim.
A UsdVariantSet represents a single VariantSet in USD (e.g.
Represents a coherent set of alternate representations for part of a scene.
std::string const & GetName() const
Return this VariantSet's name.
Defines a mapping from scene graph paths to Sdf spec paths in a SdfLayer where edits should be direct...
UsdPrim is the sole persistent scenegraph object on a UsdStage, and is the embodiment of a "Prim" as ...
USD_API bool AddVariant(const std::string &variantName, UsdListPosition position=UsdListPositionBackOfPrependList)
Author a variant spec for variantName in this VariantSet at the stage's current EditTarget,...
A path value used to locate objects in layers or scenegraphs.
USD_API bool HasVariantSet(const std::string &variantSetName) const
Returns true if a VariantSet named variantSetName exists on the originating prim.
USD_API std::vector< std::string > GetNames() const
Return a list of all VariantSets authored on the originating UsdPrim.
USD_API SdfVariantSelectionMap GetAllVariantSelections() const
Returns the composed map of all variant selections authored on the the originating UsdPrim,...
USD_API std::string GetVariantSelection() const
Return the variant selection for this VariantSet.
Represents a prim description in an SdfLayer object.
bool IsValid() const
Is this UsdVariantSet object usable? If not, calling any of its other methods is likely to crash.
USD_API bool SetVariantSelection(const std::string &variantName)
Author a variant selection for this VariantSet, setting it to variantName in the stage's current Edit...
USD_API std::vector< std::string > GetVariantNames() const
Return the composed variant names for this VariantSet, ordered lexicographically.
USD_API std::string GetVariantSelection(const std::string &variantSetName) const
Return the composed variant selection for the VariantSet named variantSetName.
The position at the back of the prepend list.
UsdVariantSets represents the collection of VariantSets that are present on a UsdPrim.
USD_API bool HasAuthoredVariant(const std::string &variantName) const
Returns true if this VariantSet already possesses a variant.
USD_API UsdVariantSet AddVariantSet(const std::string &variantSetName, UsdListPosition position=UsdListPositionBackOfPrependList)
Find an existing, or create a new VariantSet on the originating UsdPrim, named variantSetName.