usdrt::UsdGeomSubset

Defined in usdrt/scenegraph/usd/usdGeom/subset.h

class UsdGeomSubset : public usdrt::UsdTyped

Encodes a subset of a piece of geometry (i.e. a UsdGeomImageable) as a set of indices. Currently only supports encoding of face-subsets, but could be extended in the future to support subsets representing edges, segments, points etc.

To apply to a geometric prim, a GeomSubset prim must be the prim’s direct child in namespace, and possess a concrete defining specifier (i.e. def). This restriction makes it easy and efficient to discover subsets of a prim. We might want to relax this restriction if it’s common to have multiple families of subsets on a gprim and if it’s useful to be able to organize subsets belonging to a family under a common scope. See ‘familyName’ attribute for more info on defining a family of subsets.

Note that a GeomSubset isn’t an imageable (i.e. doesn’t derive from UsdGeomImageable). So, you can’t author visibility for it or override its purpose.

Materials are bound to GeomSubsets just as they are for regular geometry using API available in UsdShade (UsdShadeMaterial::Bind).

For any described attribute Fallback Value or Allowed Values below that are text/tokens, the actual token is published and defined in UsdGeomTokens. So to set an attribute to the value “rightHanded”, use UsdGeomTokens->rightHanded as the value.

Public Functions

inline explicit UsdGeomSubset(const UsdPrim &prim = UsdPrim())

Construct a UsdGeomSubset on UsdPrim prim. Equivalent to UsdGeomSubset::Get(prim.GetStage(), prim.GetPath()) for a valid prim , but will not immediately throw an error for an invalid prim.

inline explicit UsdGeomSubset(const UsdSchemaBase &schemaObj)

Construct a UsdGeomSubset on the prim held by schemaObj . Should be preferred over UsdGeomSubset(schemaObj.GetPrim()), as it preserves SchemaBase state.

inline virtual ~UsdGeomSubset()

Destructor.

inline UsdAttribute GetElementTypeAttr() const

The type of element that the indices target. Currently only allows “face” and defaults to it.

Declaration

uniform token elementType = "face"

C++ Type

TfToken

Usd Type

SdfValueTypeNames->Token

Variability

SdfVariabilityUniform

Allowed Values

face

inline UsdAttribute CreateElementTypeAttr() const

See GetElementTypeAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if writeSparsely is true - the default for writeSparsely is false.

inline UsdAttribute GetIndicesAttr() const

The set of indices included in this subset. The indices need not be sorted, but the same index should not appear more than once.

Declaration

int[] indices = []

C++ Type

VtArray<int>

Usd Type

SdfValueTypeNames->IntArray

inline UsdAttribute CreateIndicesAttr() const

See GetIndicesAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if writeSparsely is true - the default for writeSparsely is false.

inline UsdAttribute GetFamilyNameAttr() const

The name of the family of subsets that this subset belongs to. This is optional and is primarily useful when there are multiple families of subsets under a geometric prim. In some cases, this could also be used for achieving proper roundtripping of subset data between DCC apps. When multiple subsets belonging to a prim have the same familyName, they are said to belong to the family. A familyType value can be encoded on the owner of a family of subsets as a token using the static method UsdGeomSubset::SetFamilyType(). “familyType” can have one of the following values:

  • UsdGeomTokens->partition: implies that every element of the whole geometry appears exactly once in only one of the subsets belonging to the family.

  • UsdGeomTokens->nonOverlapping: an element that appears in one subset may not appear in any other subset belonging to the family.

  • UsdGeomTokens->unrestricted: implies that there are no restrictions w.r.t. the membership of elements in the subsets. They could be overlapping and the union of all subsets in the family may not represent the whole.

Declaration

uniform token familyName = ""

C++ Type

TfToken

Usd Type

SdfValueTypeNames->Token

Variability

SdfVariabilityUniform

Note

The validity of subset data is not enforced by the authoring APIs, however they can be checked using UsdGeomSubset::ValidateFamily().

inline UsdAttribute CreateFamilyNameAttr() const

See GetFamilyNameAttr(), and also Create vs Get Property Methods for when to use Get vs Create. If specified, author defaultValue as the attribute’s default, sparsely (when it makes sense to do so) if writeSparsely is true - the default for writeSparsely is false.

UsdPrim GetPrim() const

Return this schema object’s held prim.

SdfPath GetPath() const

Return the SdfPath to this schema object’s held prim.

inline explicit operator bool() const

Check if this schema object is compatible with it’s held prim and that the prim is valid.

A typed schema object is compatible if the held prim’s type is or is a subtype of the schema’s type. Based on prim.IsA().

An API schema object is compatible if the API is of type SingleApplyAPI or UsdSchemaType::MultipleApplyAPI, and the schema has been applied to the prim. Based on prim.HasAPI.

This method invokes polymorphic behaviour.

Returns

True if the help prim is valid, and the schema object is compatible with its held prim.

Public Static Functions

static inline UsdGeomSubset Define(const UsdStageRefPtr &stage, const SdfPath &path)

Attempt to ensure a UsdPrim adhering to this schema at path is defined (according to UsdPrim::IsDefined()) on this stage.

Public Static Attributes

static const UsdSchemaType schemaType = UsdSchemaType::ConcreteTyped

Compile time constant representing what kind of schema this class is.

See also

UsdSchemaType

Protected Functions

inline virtual bool _IsCompatible() const

Helper for subclasses to do specific compatibility checking with the given prim. Subclassess may override _isCompatible to for example check type compatibility or value compatibility on the prim.

Overrides exist for UsdTyped and UsdAPISchemaBase.

This check is called when clients invoke the bool operator.

Returns

True if the schema object is compatible with its held prim.

inline const TfToken _GetType() const

Helper for subclasses to get this schema’s type token.

Note

This diverges from Usd and returns a TfToken, since we don’t implements TfType.

Returns

The token representing the schema’s TfType.