All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
introspection.h File Reference

Collection of module-scoped utilities for introspecting a given USD stage. More...

+ Include dependency graph for introspection.h:

Go to the source code of this file.

Macros

#define USDUTILS_USDSTAGE_STATS
 

Functions

 SDF_DECLARE_HANDLES (SdfLayer)
 
 TF_DECLARE_PUBLIC_TOKENS (UsdUtilsUsdStageStatsKeys, USDUTILS_API, USDUTILS_USDSTAGE_STATS)
 
USDUTILS_API UsdStageRefPtr UsdUtilsComputeUsdStageStats (const std::string &rootLayerPath, VtDictionary *stats)
 Opens the given layer on a USD stage and collects various stats.
 
USDUTILS_API size_t UsdUtilsComputeUsdStageStats (const UsdStageWeakPtr &stage, VtDictionary *stats)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Computes stats on an already opened USD stage.
 

Detailed Description

Collection of module-scoped utilities for introspecting a given USD stage.

Future additions might include full-on dependency extraction, queries like "Does this stage contain this asset?", "usd grep" functionality, etc.

Definition in file introspection.h.

Macro Definition Documentation

◆ USDUTILS_USDSTAGE_STATS

#define USDUTILS_USDSTAGE_STATS
Value:
(approxMemoryInMb) \
(totalPrimCount) \
(modelCount) \
(instancedModelCount) \
(assetCount) \
(prototypeCount) \
(totalInstanceCount) \
(usedLayerCount) \
(primary) \
(prototypes) \
(primCounts) \
/*(totalPrimCount)*/ \
(activePrimCount) \
(inactivePrimCount) \
(pureOverCount) \
(instanceCount) \
(primCountsByType) \
(untyped)

Definition at line 31 of file introspection.h.

Function Documentation

◆ UsdUtilsComputeUsdStageStats() [1/2]

USDUTILS_API UsdStageRefPtr UsdUtilsComputeUsdStageStats ( const std::string &  rootLayerPath,
VtDictionary stats 
)

Opens the given layer on a USD stage and collects various stats.

The stats are populated in the dictionary-valued output param stats.

The set of stats include:

  • approxMemoryInMb - approximate memory allocated when opening the stage with all the models loaded.
  • totalPrimCount - total number of prims
  • modelCount - number of models
  • instancedModelCount - number of instanced models
  • assetCount - number of assets
  • prototypeCount - number of prototypes
  • totalInstanceCount - total number of instances (including nested instances)
  • two sub-dictionaries, 'primary' and 'prototypes' for the "primary" prim tree and for all the prototype subtrees respectively, containing the following stats:
  • primCounts - a sub-dictionary containing the following
    • totalPrimCount - number of prims
    • activePrimCount - number of active prims
    • inactivePrimCount - number of inactive prims
    • pureOverCount - number of pure overs
    • instanceCount - number of instances
  • primCountsByType - a sub-dictionary containing prim counts keyed by the prim type.

Returns the stage that was opened.

The "prototypes" subdictionary is populated only if the stage has one or more instanced models.

Note
The approximate memory allocated when opening the stage is computed and reported only if the TfMallocTag system has already been initialized by the client, and the number will represent only additional consumed memory, so if some of the layers the stage uses are already open, the true memory consumption for the stage may be higher than reported.
See also
TfMallocTag::IsInitialized()
Note
Only component models are included in 'modelCount' and 'instancedModelCount'.

◆ UsdUtilsComputeUsdStageStats() [2/2]

USDUTILS_API size_t UsdUtilsComputeUsdStageStats ( const UsdStageWeakPtr &  stage,
VtDictionary stats 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Computes stats on an already opened USD stage.

Returns the total number of prims on the stage, including active, inactive. pure overs, prims inside prototypes etc.