|
A UsdVariantSet represents a single VariantSet in USD (e.g. More...
#include <variantSets.h>
Public Member Functions | |
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, in the position specified by position . | |
USD_API std::vector< std::string > | GetVariantNames () const |
Return the composed variant names for this VariantSet, ordered lexicographically. | |
USD_API bool | HasAuthoredVariant (const std::string &variantName) const |
Returns true if this VariantSet already possesses a variant. | |
USD_API std::string | GetVariantSelection () const |
Return the variant selection for this VariantSet. | |
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 | SetVariantSelection (const std::string &variantName) |
Author a variant selection for this VariantSet, setting it to variantName in the stage's current EditTarget. | |
USD_API bool | ClearVariantSelection () |
Clear any selection for this VariantSet from the current EditTarget. | |
USD_API bool | BlockVariantSelection () |
Block any weaker selections for this VariantSet by authoring an empty string at the stage's current EditTarget. | |
USD_API UsdEditTarget | GetVariantEditTarget (const SdfLayerHandle &layer=SdfLayerHandle()) const |
Return a UsdEditTarget that edits the currently selected variant in this VariantSet in layer. | |
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. | |
UsdPrim const & | GetPrim () const |
Return this VariantSet's held prim. | |
std::string const & | GetName () const |
Return this VariantSet's name. | |
bool | IsValid () const |
Is this UsdVariantSet object usable? If not, calling any of its other methods is likely to crash. | |
operator bool () const | |
Equivalent to IsValid(). | |
Friends | |
class | UsdPrim |
class | UsdVariantSets |
A UsdVariantSet represents a single VariantSet in USD (e.g.
modelingVariant or shadingVariant), which can have multiple variations that express different sets of opinions about the scene description rooted at the prim that defines the VariantSet.
(More detailed description of variants to follow)
Definition at line 39 of file variantSets.h.
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, in the position specified by position
.
Return true if the spec was successfully authored, false otherwise.
This will create the VariantSet itself, if necessary, so as long as UsdPrim "prim" is valid, the following should always work:
USD_API bool BlockVariantSelection | ( | ) |
Block any weaker selections for this VariantSet by authoring an empty string at the stage's current EditTarget.
Return true on success, false otherwise.
USD_API bool ClearVariantSelection | ( | ) |
Clear any selection for this VariantSet from the current EditTarget.
Return true on success, false otherwise.
|
inline |
Return this VariantSet's name.
Definition at line 157 of file variantSets.h.
|
inline |
Return this VariantSet's held prim.
Definition at line 153 of file variantSets.h.
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.
Returns configuration for a UsdEditContext
To begin editing into VariantSet varSet's currently selected variant:
In C++, we would use the following pattern:
In python, the pattern is:
See GetVariantEditTarget() for discussion of layer
parameter
USD_API UsdEditTarget GetVariantEditTarget | ( | const SdfLayerHandle & | layer = SdfLayerHandle() | ) | const |
Return a UsdEditTarget that edits the currently selected variant in this VariantSet in layer.
If there is no currently selected variant in this VariantSet, return an invalid EditTarget.
If layer is unspecified, then we will use the layer of our prim's stage's current UsdEditTarget.
Currently, we require layer to be in the stage's local LayerStack (see UsdStage::HasLocalLayer()), and will issue an error and return an invalid EditTarget if layer is not. We may relax this restriction in the future, if need arises, but it introduces several complications in specification and behavior.
USD_API std::vector< std::string > GetVariantNames | ( | ) | const |
Return the composed variant names for this VariantSet, ordered lexicographically.
USD_API std::string GetVariantSelection | ( | ) | const |
Return the variant selection for this VariantSet.
If there is no selection, return the empty string.
USD_API bool HasAuthoredVariant | ( | const std::string & | variantName | ) | const |
Returns true if this VariantSet already possesses a variant.
USD_API bool HasAuthoredVariantSelection | ( | std::string * | value = nullptr | ) | const |
Returns true if there is a selection authored for this VariantSet in any layer.
If requested, the variant selection (if any) will be returned in value
.
|
inline |
Is this UsdVariantSet object usable? If not, calling any of its other methods is likely to crash.
Definition at line 162 of file variantSets.h.
|
inlineexplicit |
Equivalent to IsValid().
Definition at line 167 of file variantSets.h.
USD_API bool SetVariantSelection | ( | const std::string & | variantName | ) |
Author a variant selection for this VariantSet, setting it to variantName in the stage's current EditTarget.
If variantName
is empty, clear the variant selection (see ClearVariantSelection). Call BlockVariantSelection to explicitly set an empty variant selection.
Return true if the selection was successfully authored or cleared, false otherwise.
|
friend |
Definition at line 185 of file variantSets.h.
|
friend |
Definition at line 186 of file variantSets.h.