HDK
|
#include <variantSets.h>
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 56 of file variantSets.h.
USD_API bool UsdVariantSet::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 UsdVariantSet::BlockVariantSelection | ( | ) |
Blocks any weaker selection for this VariantSet, setting it to empty in the stage's current EditTarget. Return true on success, false otherwise.
USD_API bool UsdVariantSet::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 168 of file variantSets.h.
Return this VariantSet's held prim.
Definition at line 164 of file variantSets.h.
USD_API std::pair<UsdStagePtr, UsdEditTarget> UsdVariantSet::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 UsdVariantSet::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> UsdVariantSet::GetVariantNames | ( | ) | const |
Return the composed variant names for this VariantSet, ordered lexicographically.
USD_API std::string UsdVariantSet::GetVariantSelection | ( | ) | const |
Return the variant selection for this VariantSet. If there is no selection, return the empty string.
USD_API bool UsdVariantSet::HasAuthoredVariant | ( | const std::string & | variantName | ) | const |
Returns true if this VariantSet already possesses a variant.
USD_API bool UsdVariantSet::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 173 of file variantSets.h.
|
inlineexplicit |
Equivalent to IsValid().
Definition at line 178 of file variantSets.h.
USD_API bool UsdVariantSet::SetVariantSelection | ( | const std::string & | variantName | ) |
Author a variant selection for this VariantSet, setting it to variantName in the stage's current EditTarget. Return true if the selection was successfully authored, false otherwise.
Definition at line 196 of file variantSets.h.
|
friend |
Definition at line 197 of file variantSets.h.