7#ifndef PXR_USD_USD_VARIANT_SETS_H
8#define PXR_USD_USD_VARIANT_SETS_H
11#include "pxr/usd/usd/api.h"
13#include "pxr/usd/usd/editTarget.h"
21PXR_NAMESPACE_OPEN_SCOPE
148 std::pair<UsdStagePtr, UsdEditTarget>
157 std::string
const &
GetName()
const {
return _variantSetName; }
163 return static_cast<bool>(_prim);
167 explicit operator bool()
const {
173 const std::string &variantSetName)
175 , _variantSetName(variantSetName)
179 SdfPrimSpecHandle _CreatePrimSpecForEditing();
183 std::string _variantSetName;
229 bool GetNames(std::vector<std::string>* names)
const;
235 UsdVariantSet operator[](
const std::string& variantSetName)
const {
257 bool SetSelection(
const std::string& variantSetName,
258 const std::string& variantName);
280PXR_NAMESPACE_CLOSE_SCOPE
A scene description container that can combine with other such containers to form simple component as...
A path value used to locate objects in layers or scenegraphs.
Represents a prim description in an SdfLayer object.
Represents a coherent set of alternate representations for part of a scene.
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 ...
A UsdVariantSet represents a single VariantSet in USD (e.g.
USD_API std::string GetVariantSelection() const
Return the variant selection for this VariantSet.
std::string const & GetName() const
Return this VariantSet's name.
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,...
USD_API bool BlockVariantSelection()
Block any weaker selections for this VariantSet by authoring an empty string at the stage's current E...
UsdPrim const & GetPrim() const
Return this VariantSet's held prim.
USD_API bool HasAuthoredVariant(const std::string &variantName) const
Returns true if this VariantSet already possesses a variant.
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::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 std::vector< std::string > GetVariantNames() const
Return the composed variant names for this VariantSet, ordered lexicographically.
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 UsdEditTarget GetVariantEditTarget(const SdfLayerHandle &layer=SdfLayerHandle()) const
Return a UsdEditTarget that edits the currently selected variant in this VariantSet in layer.
bool IsValid() const
Is this UsdVariantSet object usable? If not, calling any of its other methods is likely to crash.
USD_API bool ClearVariantSelection()
Clear any selection for this VariantSet from the current EditTarget.
UsdVariantSets represents the collection of VariantSets that are present on a UsdPrim.
USD_API std::string GetVariantSelection(const std::string &variantSetName) const
Return the composed variant selection for the VariantSet named variantSetName.
USD_API SdfVariantSelectionMap GetAllVariantSelections() const
Returns the composed map of all variant selections authored on the the originating UsdPrim,...
USD_API UsdVariantSet GetVariantSet(const std::string &variantSetName) const
Return a UsdVariantSet object for variantSetName.
USD_API std::vector< std::string > GetNames() const
Return a list of all VariantSets authored on the originating UsdPrim.
USD_API bool HasVariantSet(const std::string &variantSetName) const
Returns true if a VariantSet named variantSetName exists on the originating prim.
USD_API bool GetNames(std::vector< std::string > *names) const
Compute the list of all VariantSets authored on the originating UsdPrim.
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.
UsdListPosition
Specifies a position to add items to lists.
@ UsdListPositionBackOfPrependList
The position at the back of the prepend list.
std::map< std::string, std::string > SdfVariantSelectionMap
A map of reference variant set names to variants in those sets.