HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GusdGU_USD Class Reference

#include <GU_USD.h>

Public Types

enum  OrientAttrRepresentation { ORIENTATTR_ORIENT, ORIENTATTR_IJK, ORIENTATTR_IGNORE }
 
enum  ScaleAttrRepresentation { SCALEATTR_SCALE, SCALEATTR_PSCALE, SCALEATTR_IGNORE }
 
typedef GU_PrimPacked *(* PackedPrimBuildFunc )(GU_Detail &detail, const UT_StringHolder &fileName, const SdfPath &primPath, const UsdTimeCode &frame, const char *lod, const GusdPurposeSet purposes)
 
typedef
GusdUSD_Traverse::PrimIndexPair 
PrimIndexPair
 

Static Public Member Functions

static bool OffsetArrayFromRange (const GA_Range &r, GA_OffsetArray &offsets)
 
static bool ComputeRangeIndexMap (const GA_Range &r, GA_OffsetArray &indexMap)
 
static bool BindPrims (GusdStageCacheReader &cache, UT_Array< UsdPrim > &prims, const GA_Detail &gd, const GA_Range &rng, UT_Array< SdfPath > *variants=nullptr, GusdDefaultArray< GusdPurposeSet > *purposes=nullptr, GusdDefaultArray< UsdTimeCode > *times=nullptr, UT_ErrorSeverity sev=UT_ERROR_ABORT)
 
static bool BindPrimsFromAttrs (GusdStageCacheReader &cache, UT_Array< UsdPrim > &prims, const GA_Range &rng, const GA_Attribute &pathAttr, const GA_Attribute &primPathAttr, const GA_Attribute *variantsAttr, UT_Array< SdfPath > *variants=nullptr, UT_ErrorSeverity sev=UT_ERROR_ABORT)
 
static bool BindPrimsFromPackedPrims (UT_Array< UsdPrim > &prims, const GA_Range &rng, UT_Array< SdfPath > *variants=nullptr, UT_Array< GusdPurposeSet > *purposes=nullptr, UT_ErrorSeverity sev=UT_ERROR_ABORT)
 
static bool GetTimeCodesFromAttr (const GA_Range &rng, const GA_Attribute &attr, UT_Array< UsdTimeCode > &times)
 
static bool GetTimeCodesFromPackedPrims (const GA_Range &rng, UT_Array< UsdTimeCode > &times)
 
static GA_Offset AppendRefPoints (GU_Detail &gd, const UT_Array< UsdPrim > &prims, const char *pathAttrName=GUSD_PATH_ATTR, const char *primPathAttrName=GUSD_PRIMPATH_ATTR)
 
static void RegisterPackedPrimBuildFunc (const TfToken &typeName, PackedPrimBuildFunc func)
 
static bool AppendPackedPrims (GU_Detail &gd, const UT_Array< UsdPrim > &prims, const UT_Array< SdfPath > &variants, const GusdDefaultArray< UsdTimeCode > &times, const GusdDefaultArray< UT_StringHolder > &lods, const GusdDefaultArray< GusdPurposeSet > &purposes, GusdGU_PackedUSD::PivotLocation pivotloc)
 
static bool AppendPackedPrimsFromLopNode (GU_Detail &gd, const UT_Array< UsdPrim > &prims, const GusdDefaultArray< UT_StringHolder > &stageids, const GusdDefaultArray< UsdTimeCode > &times, const GusdDefaultArray< UT_StringHolder > &lods, const GusdDefaultArray< GusdPurposeSet > &purposes, GusdGU_PackedUSD::PivotLocation pivotloc)
 
static GA_Offset AppendExpandedRefPoints (GU_Detail &gd, const GA_Detail &srcGd, const GA_Range &srcRng, const UT_Array< PrimIndexPair > &prims, const GA_AttributeFilter &filter, const char *pathAttrName=GUSD_PATH_ATTR, const char *primPathAttrName=GUSD_PRIMPATH_ATTR)
 
static bool AppendExpandedPackedPrims (GU_Detail &gd, const GA_Detail &srcGd, const GA_Range &srcRng, const UT_Array< PrimIndexPair > &primIndexPairs, const UT_Array< SdfPath > &variants, const GusdDefaultArray< UsdTimeCode > &times, const GA_AttributeFilter &filter, bool unpackToPolygons, const UT_String &primvarPattern, const UT_String &attributePattern, bool translateSTtoUV, const UT_StringRef &nonTransformingPrimvarPattern, GusdGU_PackedUSD::PivotLocation pivotloc)
 
static bool AppendExpandedPackedPrimsFromLopNode (GU_Detail &gd, const GA_Detail &srcGd, const GA_Range &srcRng, const UT_Array< PrimIndexPair > &primIndexPairs, const GusdDefaultArray< UsdTimeCode > &times, const GA_AttributeFilter &filter, bool unpackToPolygons, const UT_String &primvarPattern, bool importInheritedPrimvars, const UT_String &attributePattern, bool translateSTtoUV, const UT_StringRef &nonTransformingPrimvarPattern, GusdGU_PackedUSD::PivotLocation pivotloc, const UT_StringHolder &filePathAttrib=GUSD_PATH_ATTR, const UT_StringHolder &primPathAttrib=GUSD_PRIMPATH_ATTR, const GT_RefineParms *refineParms=nullptr)
 
static bool WriteVariantSelectionsToAttr (GU_Detail &gd, const GA_Range &rng, const UT_Array< UsdPrim > &prims, const GusdUSD_Utils::VariantSelArray &selections, const char *variantsAttr=GUSD_VARIANTS_ATTR, const UT_Array< SdfPath > *prevVariants=nullptr)
 
static bool WriteVariantSelectionsToPackedPrims (GU_Detail &gd, const GA_Range &rng, const UT_Array< UsdPrim > &prims, const GusdUSD_Utils::VariantSelArray &selections, const UT_Array< SdfPath > *prevVariants=nullptr)
 
static GA_Offset AppendRefPointsForExpandedVariants (GU_Detail &gd, const GA_Detail &srcGd, const GA_Range &srcRng, const UT_Array< UT_StringHolder > &orderedVariants, const GusdUSD_Utils::IndexPairArray &variantIndices, const GA_AttributeFilter &filter, const char *variantsAttr=GUSD_VARIANTS_ATTR)
 
static GA_Offset AppendPackedPrimsForExpandedVariants (GU_Detail &gd, const GA_Detail &srcGd, const GA_Range &srcRng, const UT_Array< UT_StringHolder > &orderedVariants, const GusdUSD_Utils::IndexPairArray &variantIndices, const GA_AttributeFilter &filter)
 
static bool GetPackedPrimStageIdsViewportLODsAndPurposes (const GA_Detail &gd, const GA_OffsetArray &offsets, UT_StringArray &stageIds, UT_StringArray &viewportLODs, UT_Array< GusdPurposeSet > &purposes)
 
static bool ComputeTransformsFromAttrs (const GA_Detail &gd, GA_AttributeOwner owner, const GA_OffsetArray &offsets, UT_Matrix4D *xforms)
 
static bool ComputeTransformsFromPackedPrims (const GA_Detail &gd, const GA_OffsetArray &offsets, UT_Matrix4D *xforms)
 
static bool SetTransformAttrs (GU_Detail &gd, const GA_Range &r, const GA_OffsetArray &indexMap, OrientAttrRepresentation orientRep, ScaleAttrRepresentation scaleRep, const UT_Matrix4D *xforms)
 
static bool SetPackedPrimTransforms (GU_Detail &gd, const GA_Range &r, const UT_Matrix4D *xforms)
 
static bool MultTransformableAttrs (GU_Detail &gd, const GA_Range &r, const GA_OffsetArray &indexMap, const UT_Matrix4D *xforms, bool keepLengths=false, const GA_AttributeFilter *filter=nullptr)
 
static bool ImportPrimUnpacked (GU_Detail &gd, const UsdPrim &prim, UsdTimeCode time, const char *lod=nullptr, GusdPurposeSet purpose=GusdPurposeSet(GUSD_PURPOSE_DEFAULT|GUSD_PURPOSE_PROXY), const UT_StringRef &primvarPattern="*", const UT_StringRef &attributePattern=UT_StringHolder::theEmptyString, bool translateSTtoUV=true, const UT_StringRef &nonTransformingPrimvarPattern=GA_Names::rest, const UT_Matrix4D *xform=nullptr, const GT_RefineParms *refineParms=nullptr)
 Imports prim as unpacked geometry in gd. More...
 
static bool GetPrimPathsFromStringAttr (const GA_Attribute &attr, UT_Array< SdfPath > &paths, UT_ErrorSeverity sev=UT_ERROR_ABORT)
 
static bool GetPrimPathsFromStringAttr (const GA_Attribute &attr, const GA_Range &rng, UT_Array< SdfPath > &paths, UT_ErrorSeverity sev=UT_ERROR_ABORT)
 
static bool GetTokensFromStringAttr (const GA_Attribute &attr, UT_Array< TfToken > &tokens, const char *nameSpace=nullptr)
 
static bool GetTokensFromStringAttr (const GA_Attribute &attr, const GA_Range &rng, UT_Array< TfToken > &tokens, const char *nameSpace=nullptr)
 

Detailed Description

Set of helpers for working with ranges of prims/points, etc.

Definition at line 88 of file GU_USD.h.

Member Typedef Documentation

typedef GU_PrimPacked*(* GusdGU_USD::PackedPrimBuildFunc)(GU_Detail &detail, const UT_StringHolder &fileName, const SdfPath &primPath, const UsdTimeCode &frame, const char *lod, const GusdPurposeSet purposes)

Definition at line 175 of file GU_USD.h.

Member Enumeration Documentation

Support representations of attributes when authoring new transforms.

Enumerator
ORIENTATTR_ORIENT 
ORIENTATTR_IJK 

quaternion orient.

ORIENTATTR_IGNORE 

vec3 i,j,k (can be non-orthogonal).

Definition at line 325 of file GU_USD.h.

Enumerator
SCALEATTR_SCALE 
SCALEATTR_PSCALE 

scale (vec3).

SCALEATTR_IGNORE 

single pscale.

Definition at line 332 of file GU_USD.h.

Member Function Documentation

static bool GusdGU_USD::AppendExpandedPackedPrims ( GU_Detail gd,
const GA_Detail srcGd,
const GA_Range srcRng,
const UT_Array< PrimIndexPair > &  primIndexPairs,
const UT_Array< SdfPath > &  variants,
const GusdDefaultArray< UsdTimeCode > &  times,
const GA_AttributeFilter filter,
bool  unpackToPolygons,
const UT_String primvarPattern,
const UT_String attributePattern,
bool  translateSTtoUV,
const UT_StringRef nonTransformingPrimvarPattern,
GusdGU_PackedUSD::PivotLocation  pivotloc 
)
static
static bool GusdGU_USD::AppendExpandedPackedPrimsFromLopNode ( GU_Detail gd,
const GA_Detail srcGd,
const GA_Range srcRng,
const UT_Array< PrimIndexPair > &  primIndexPairs,
const GusdDefaultArray< UsdTimeCode > &  times,
const GA_AttributeFilter filter,
bool  unpackToPolygons,
const UT_String primvarPattern,
bool  importInheritedPrimvars,
const UT_String attributePattern,
bool  translateSTtoUV,
const UT_StringRef nonTransformingPrimvarPattern,
GusdGU_PackedUSD::PivotLocation  pivotloc,
const UT_StringHolder filePathAttrib = GUSD_PATH_ATTR,
const UT_StringHolder primPathAttrib = GUSD_PRIMPATH_ATTR,
const GT_RefineParms refineParms = nullptr 
)
static
static GA_Offset GusdGU_USD::AppendExpandedRefPoints ( GU_Detail gd,
const GA_Detail srcGd,
const GA_Range srcRng,
const UT_Array< PrimIndexPair > &  prims,
const GA_AttributeFilter filter,
const char *  pathAttrName = GUSD_PATH_ATTR,
const char *  primPathAttrName = GUSD_PRIMPATH_ATTR 
)
static

Append prims prims, as an expansion of prims defined on srcRange. The prim index pairs provide the prim found in the expansion, and the index of the prim in the source range whose expansion produced that prim. Attributes and groups matching filter are copied from the source to the newly created ref points.

static bool GusdGU_USD::AppendPackedPrims ( GU_Detail gd,
const UT_Array< UsdPrim > &  prims,
const UT_Array< SdfPath > &  variants,
const GusdDefaultArray< UsdTimeCode > &  times,
const GusdDefaultArray< UT_StringHolder > &  lods,
const GusdDefaultArray< GusdPurposeSet > &  purposes,
GusdGU_PackedUSD::PivotLocation  pivotloc 
)
static

Append packed prims to the given detail that reference the given prims with the given variants.

static GA_Offset GusdGU_USD::AppendPackedPrimsForExpandedVariants ( GU_Detail gd,
const GA_Detail srcGd,
const GA_Range srcRng,
const UT_Array< UT_StringHolder > &  orderedVariants,
const GusdUSD_Utils::IndexPairArray variantIndices,
const GA_AttributeFilter filter 
)
static
static bool GusdGU_USD::AppendPackedPrimsFromLopNode ( GU_Detail gd,
const UT_Array< UsdPrim > &  prims,
const GusdDefaultArray< UT_StringHolder > &  stageids,
const GusdDefaultArray< UsdTimeCode > &  times,
const GusdDefaultArray< UT_StringHolder > &  lods,
const GusdDefaultArray< GusdPurposeSet > &  purposes,
GusdGU_PackedUSD::PivotLocation  pivotloc 
)
static

More specialized function for appending prims to the given detail from a LOP node where the variants are already chosen, and the LOP node path needs to be set as the file path on the packed prim.

static GA_Offset GusdGU_USD::AppendRefPoints ( GU_Detail gd,
const UT_Array< UsdPrim > &  prims,
const char *  pathAttrName = GUSD_PATH_ATTR,
const char *  primPathAttrName = GUSD_PRIMPATH_ATTR 
)
static

Append points to a detail that represent references to prims. The point offsets are contiguous, and the offset of the first point is returned. If any failures occur, and invalid offset is returned.

static GA_Offset GusdGU_USD::AppendRefPointsForExpandedVariants ( GU_Detail gd,
const GA_Detail srcGd,
const GA_Range srcRng,
const UT_Array< UT_StringHolder > &  orderedVariants,
const GusdUSD_Utils::IndexPairArray variantIndices,
const GA_AttributeFilter filter,
const char *  variantsAttr = GUSD_VARIANTS_ATTR 
)
static

Append variant selections defined by orderedVariants and variantIndices as an expansion of prims from srcRng. Attributes and groups matching attrs filter are copied from the source to the newly created ref points.

static bool GusdGU_USD::BindPrims ( GusdStageCacheReader cache,
UT_Array< UsdPrim > &  prims,
const GA_Detail gd,
const GA_Range rng,
UT_Array< SdfPath > *  variants = nullptr,
GusdDefaultArray< GusdPurposeSet > *  purposes = nullptr,
GusdDefaultArray< UsdTimeCode > *  times = nullptr,
UT_ErrorSeverity  sev = UT_ERROR_ABORT 
)
static
static bool GusdGU_USD::BindPrimsFromAttrs ( GusdStageCacheReader cache,
UT_Array< UsdPrim > &  prims,
const GA_Range rng,
const GA_Attribute pathAttr,
const GA_Attribute primPathAttr,
const GA_Attribute variantsAttr,
UT_Array< SdfPath > *  variants = nullptr,
UT_ErrorSeverity  sev = UT_ERROR_ABORT 
)
static

Bind prims from references defined in the given attributes. This creates an entry in prims for each entry in the given range, mapped to the corresponding prim. If variants is non-null, resolved variant paths are stored in the given array.

static bool GusdGU_USD::BindPrimsFromPackedPrims ( UT_Array< UsdPrim > &  prims,
const GA_Range rng,
UT_Array< SdfPath > *  variants = nullptr,
UT_Array< GusdPurposeSet > *  purposes = nullptr,
UT_ErrorSeverity  sev = UT_ERROR_ABORT 
)
static
static bool GusdGU_USD::ComputeRangeIndexMap ( const GA_Range r,
GA_OffsetArray indexMap 
)
static

Compute an array mapping offset->range_index for the given range.

static bool GusdGU_USD::ComputeTransformsFromAttrs ( const GA_Detail gd,
GA_AttributeOwner  owner,
const GA_OffsetArray offsets,
UT_Matrix4D xforms 
)
static

Compute world transforms from attributes over an array of offsets.

In addition to using the standard instancing attributes, this supports an additional schema for non-orthonormal transforms, where the basis vectors (rows) of a rotation matrix are stored as normal attributes 'i', 'j', 'k'.

static bool GusdGU_USD::ComputeTransformsFromPackedPrims ( const GA_Detail gd,
const GA_OffsetArray offsets,
UT_Matrix4D xforms 
)
static
static bool GusdGU_USD::GetPackedPrimStageIdsViewportLODsAndPurposes ( const GA_Detail gd,
const GA_OffsetArray offsets,
UT_StringArray stageIds,
UT_StringArray viewportLODs,
UT_Array< GusdPurposeSet > &  purposes 
)
static
static bool GusdGU_USD::GetPrimPathsFromStringAttr ( const GA_Attribute attr,
UT_Array< SdfPath > &  paths,
UT_ErrorSeverity  sev = UT_ERROR_ABORT 
)
static

Given a string attribute that represents prim paths, return an array of actual prim paths.

static bool GusdGU_USD::GetPrimPathsFromStringAttr ( const GA_Attribute attr,
const GA_Range rng,
UT_Array< SdfPath > &  paths,
UT_ErrorSeverity  sev = UT_ERROR_ABORT 
)
static

Given a string attribute that represents prim paths, return an array of actual prim paths.

static bool GusdGU_USD::GetTimeCodesFromAttr ( const GA_Range rng,
const GA_Attribute attr,
UT_Array< UsdTimeCode > &  times 
)
static
static bool GusdGU_USD::GetTimeCodesFromPackedPrims ( const GA_Range rng,
UT_Array< UsdTimeCode > &  times 
)
static
static bool GusdGU_USD::GetTokensFromStringAttr ( const GA_Attribute attr,
UT_Array< TfToken > &  tokens,
const char *  nameSpace = nullptr 
)
static

Givena string attribute, return an array of tokens.

static bool GusdGU_USD::GetTokensFromStringAttr ( const GA_Attribute attr,
const GA_Range rng,
UT_Array< TfToken > &  tokens,
const char *  nameSpace = nullptr 
)
static

Givena string attribute, return an array of tokens.

static bool GusdGU_USD::ImportPrimUnpacked ( GU_Detail gd,
const UsdPrim prim,
UsdTimeCode  time,
const char *  lod = nullptr,
GusdPurposeSet  purpose = GusdPurposeSet(GUSD_PURPOSE_DEFAULT|GUSD_PURPOSE_PROXY),
const UT_StringRef primvarPattern = "*",
const UT_StringRef attributePattern = UT_StringHolder::theEmptyString,
bool  translateSTtoUV = true,
const UT_StringRef nonTransformingPrimvarPattern = GA_Names::rest,
const UT_Matrix4D xform = nullptr,
const GT_RefineParms refineParms = nullptr 
)
static

Imports prim as unpacked geometry in gd.

static bool GusdGU_USD::MultTransformableAttrs ( GU_Detail gd,
const GA_Range r,
const GA_OffsetArray indexMap,
const UT_Matrix4D xforms,
bool  keepLengths = false,
const GA_AttributeFilter filter = nullptr 
)
static
static bool GusdGU_USD::OffsetArrayFromRange ( const GA_Range r,
GA_OffsetArray offsets 
)
static

Compute an array of offsets from a range.

static void GusdGU_USD::RegisterPackedPrimBuildFunc ( const TfToken typeName,
PackedPrimBuildFunc  func 
)
static

Register a function to be used by AppendPackedPrims to build a packed prim of the given type.

static bool GusdGU_USD::SetPackedPrimTransforms ( GU_Detail gd,
const GA_Range r,
const UT_Matrix4D xforms 
)
static
static bool GusdGU_USD::SetTransformAttrs ( GU_Detail gd,
const GA_Range r,
const GA_OffsetArray indexMap,
OrientAttrRepresentation  orientRep,
ScaleAttrRepresentation  scaleRep,
const UT_Matrix4D xforms 
)
static

Create and set transform attributes over the given range. The indexMap maps offset->range_index, as computed by ComputeRangeIndexMap().

static bool GusdGU_USD::WriteVariantSelectionsToAttr ( GU_Detail gd,
const GA_Range rng,
const UT_Array< UsdPrim > &  prims,
const GusdUSD_Utils::VariantSelArray selections,
const char *  variantsAttr = GUSD_VARIANTS_ATTR,
const UT_Array< SdfPath > *  prevVariants = nullptr 
)
static

Apply all variant selections in selections to each prim in the range, storing the resulting variant path in variantsAttr. For each source prim, this will first validate that the variant selection is valid on the target prims. If prevVariants is supplied, the variant selections are added on top of any variant selections in the given paths.

static bool GusdGU_USD::WriteVariantSelectionsToPackedPrims ( GU_Detail gd,
const GA_Range rng,
const UT_Array< UsdPrim > &  prims,
const GusdUSD_Utils::VariantSelArray selections,
const UT_Array< SdfPath > *  prevVariants = nullptr 
)
static

The documentation for this class was generated from the following file: